making a form

Hello,
I’m trying to make a form with SmartGWT, and stumbled upon a problem I don’t know how to fix.

Basically I need to know how I can fetch the text content in a TextAreaItem. There are no getText() method for it. So how should I get the text from that widget? Or is there another approach in SmartGWT? Same question goes for how I should retrieve the text from a FormItem.

Hi gamno!

I don’t know how to do it in SmartGWT but in Smartclient you can do this by three ways:

var item = formContainingWidget.getItem(“itemName”);
var text = item.getValue();

or

var field = formContainingWidget.getField(“fieldName”);
var text = field.getValue();

or

var text = formContainingWidget.getValue(“itemName”);

Note that getField() and getItem() return the same object (FileItem) so there’s no difference between them.

Also, the value obtained may not be a string depending on the item type (it can be an integer, a float, a long).

If you really need the value as a string, you can easily get around doing:

ver text = “” + formContainingWidget.getValue(“itemName”);

ops, just realized I posted the question in wrong forum. Sorry

No problem!
It is a pleasure to help you!