Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » How to get data out of formdata by fieldName
How to get data out of formdata by fieldName [message #1278725] Thu, 27 March 2014 19:18 Go to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

On the server I load formData. Now I have to get a particular value from this formdata but I only have the fieldname of the field I need. For example fieldname = "lastname"

If I call formdata.getFieldById(fieldname) I get an AbstractFormFieldData. Although with the debugger I can see it holds the value I need, I cannot get it.

Is there a way to get this value?

Regards Bertin
Re: How to get data out of formdata by fieldName [message #1279020 is a reply to message #1278725] Fri, 28 March 2014 06:06 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Your problem comes from the difference between AbstractFormFieldData and its subclass AbstractValueFieldData.

Here a possible snippet:

private Object getSingleValueFromFormData(AbstractFormData formData, String id) {
  AbstractFormFieldData fieldData = formData.getFieldById(id);
  if (fieldData instanceof AbstractValueFieldData) {
    return ((AbstractValueFieldData) fieldData).getValue();
  } 
  throw new IllegalArgumentException("the FormFieldData is not a ValueFieldData");
}
Previous Topic:Dynamic resizing of table columns
Next Topic:In table editing questions
Goto Forum:
  


Current Time: Tue Mar 19 08:43:33 GMT 2024

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

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

Back to the top