On 26/07/2010 23:31, Sven Pfeiffer wrote:
> 
> 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)


Are you sure you are using 2.1.0 and not 2.0.1? I just checked the source code 
for 2.0.1 [1] and it
contains the exception you are referring to. But this isn't present in 2.1.0 
[2]. In 2.1.0 the
parent Form is looked up dynamically if it is null.

Anyway, I think the problem is that dataSet is added to protFS before protFS 
parent form is set.

You can fix it by adding the protFS to the form first:

  form.addTabSheet(protFS);
  protFS.add(dataSet);

Kind regards

Bob

[1]:
http://svn.apache.org/viewvc/click/tags/click-2.0.1/framework/src/org/apache/click/control/FieldSet.java?view=markup
[2]:
http://svn.apache.org/viewvc/click/tags/click-2.1.0/framework/src/org/apache/click/control/FieldSet.java?view=markup


> 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