Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » init radio buttons
init radio buttons [message #1039785] Fri, 12 April 2013 15:32 Go to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

I have a form with some radio buttons (In a radioButtonGroup). When the form is shown I would like to have the radiobuttons being selected or not selected, which depends on some formData values that have been filled in the prepareCreate or load method of the service.

Which event should I use to set the buttons selected or not. I cannot find one, InitForm or Init Field does not seem to work. Is there some after load data event?

Regards Bertin

Re: init radio buttons [message #1041479 is a reply to message #1039785] Mon, 15 April 2013 06:45 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
A RadioButtonGroup is a normal value field. From a FormData point of view it works like any other field.

Have a look at the example I added on the wiki. Let me know if you need more information.

[Updated on: Mon, 15 April 2013 07:34]

Report message to a moderator

Re: init radio buttons [message #1043067 is a reply to message #1041479] Wed, 17 April 2013 08:21 Go to previous messageGo to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

so if I want to enable or disable fields on a form directly after it is shown, is there an event that I can use or method that I can override. Keep in mind that I need the formData to decide whether or not the field shoud be enabled.

What works is that I add an additional method call enableFields() in the form Handler (See eaxmple below) directly after the importFormData, but I doubt if this is the "Scout" way to do it.

Regards Bertin

  public class ModifyHandler extends AbstractFormHandler {

    @Override
    public void execLoad() throws ProcessingException {
      IDbcProcessService service = SERVICES.getService(IDbcProcessService.class);
      DBCFormData formData = new DBCFormData();
      exportFormData(formData);
      formData = service.load(formData);
      importFormData(formData);
      enableFields();
      setEnabledPermission(new UpdateDBCPermission());
    }

Re: init radio buttons [message #1043119 is a reply to message #1043067] Wed, 17 April 2013 09:58 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I read your question again... It is about enable/disable some radio buttons (this has nothing to do with selected or not). All of them or just one?

Can you confirm it before I look into it?


There is no information about enable/disable in the form data (formData is about data, not UI state). So it is something that you will need to add in your form depending on your business logic. You can use a boolean variable in the form (that is added to the FormData if you use the @FormData annotation) as a flag to express what you want. After that, you will need to read it in execLoad and call setEnabled(..) depending on your value.
Re: init radio buttons [message #1043172 is a reply to message #1043119] Wed, 17 April 2013 11:24 Go to previous message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi Jeremie

So in the formData I have a lot of fieldValues. Now when a particular field value is false, then other fields should be disabled.

So when is the correct moment to do this. I expected some kind of event or method in the base class to do this, but I can't find an appropiate one. My own solution is to do this after the importFormData is executed. Then I can read the formData values and enable / disable controls.

It works what I have now but I wandered if there already is such a method or event that is always executed after the formData is loaded. I have no problem adding the call as I did in the example but if there is a better "Scout" way to do it I would perfer that.

Regards bertin
Previous Topic:Modular Application
Next Topic:Scalability concerns
Goto Forum:
  


Current Time: Thu Apr 25 11:24:48 GMT 2024

Powered by FUDForum. Page generated in 0.03015 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top