Hi Bob,

the first FieldSet (protFS) is added to the form as a tab using addTabSheet, afaik this is the only way to add a tab to the form.

The second FieldSet is only added to protFS (which will be the tab).
I don't think it's an autobinding issue because dataSet is not a field but only locally defined, the page is not stateful.

TabbedForm is basically a Form with a number of FieldSets that are rendered as Tabs.

I know, protFS is the FieldSet that is used as Tab, dataSet is the FieldSet I'd like to have inside the Tab.

Maybe the Stacktrace will help:

java.lang.IllegalArgumentException: Cannot set the FieldSet's form to null
       at org.apache.click.control.FieldSet.setForm(FieldSet.java:596)
       at org.apache.click.control.FieldSet.insert(FieldSet.java:205)
       at org.apache.click.control.FieldSet.add(FieldSet.java:243)
       at org.apache.click.control.FieldSet.add(FieldSet.java:263)

Thanks in advance
SVen




Bob Schellink wrote:
Hi Sven,

On 26/07/2010 22:27, Sven Pfeiffer wrote:
I'd like to add a FieldSet to tab in a TabbedForm, my code looks like this:

TabbedForm form = new TabbedForm("form");
FieldSet protFS = new FieldSet("protocol");
FieldSet dataSet = new FieldSet("data");

... adding fields to dataSet

protFS.add(dataSet); // this crashes
form.addTabSheet(protFS);

The line protFS.add(dataSet) crashes with the following Exception:
java.lang.IllegalArgumentException: Cannot set the FieldSet's form to null


In your example above you are adding one FieldSet to another FieldSet, not the 
TabbedForm.

Regardless it sounds as if dataSet has already been added to another parent? 
Are you using
Autobinding or a Stateful page perhaps?


I also tried setting the form manually:
dataSet.setForm(form);

Currently I am using click 2.1.0

Is there any way to add a FieldSet to a tab?


TabbedForm is basically a Form with a number of FieldSets that are rendered as 
Tabs. But it looks
like you want to add a FieldSet to another FieldSet? It should work though.

Kind regards

Bob



Reply via email to