Bind textarea

I have a couple of large varchar2(1024) attributes on my Oracle table. I want to bind and display these in text areas on my form, but it complains about it on entry to the form … TextField cannot be cast to TextArea. Any ideas?

can you please share your source code?

BTW, I always use eithe field factory or create and bind it myself

[b] //Untested Psuedo code [/b] TextArea area = new TextArea(); //Text Area Properties fieldGroup.bind(area, "myLargeTextField"); //Add the Text Area to your form Hope this helps you, if it doesn’t please share the source code, so that we can help you

Hi,

In my DV, meeting.notes is a varchar2(1024);

In my entity class, i have the notes field declared:-

private String notes;

with getters and setters…

public String getNotes() {
    return this.notes;
}

public void setNotes(String notes) {
    this.notes = notes;
}

In my meeting class (which displays the fields from a meeting), i have the following:-

@PropertyId(“notes”)
private TextField notes;

details.addComponent(fg.buildAndBind(“notes”));

This way, it all works as expected (albeit as a single line text field).

If i change to:-

TextArea pnotesField = (TextArea) fg.buildAndBind(“notes”);
pnotesField.setWidth(“100%”);
pnotesField.setRows(5);
pnotesField.setNullRepresentation(“”);
details.addComponent(pnotesField);

I get the error (even if i declare the field as private TextArea notes;)…

Thanks in advance…

Hi, Any ideas!?

Hi johnk,

Krishna already told you a good way to solve your problem. Create the field manualy and bind it. As good as if you would use the FieldGroups FieldGroupFieldFactory.

If you realy want the field group to create the field you could try this method (but I have not tested it…):

TextArea pnotesField = fg.buildAndBind("YOUR_CAPTION", "notes", TextArea.class);

Your problem is that the DefaultFieldGroupFieldFactory returns only TextField instances for String properties until you tell it something else.

Your suggestion was the only way to get this working, thanks:-

TextArea pnotesField = fg.buildAndBind(“YOUR_CAPTION”, “notes”, TextArea.class);