users@woodstock.java.net

Re: How to get modifiable componet ID's in form

From: Venkatesh Babu <Venkatesh.M_at_Sun.COM>
Date: Wed, 23 Apr 2008 13:16:02 +0530

Vijay Reddy wrote:
> Hi,
> Using Woodstock components 4.2 in our application.
> I am new to JSF/Woodstock.
> My question is :
> I have form which had text fields , radio buttons etc.. (both
> modifiable and non modifiable fields. And when form is submitted I
> have to check which fields are modified .
> Can anyone suggest how to write generic code which I can use to check
> for all the forms in my application. I need to get all component id's
> which are modified by user .
Have you tried using the valueChangeListener that i told you earlier?
You can bind all the text field/radio buttons to a valuechangelistener
and in the listener, you can append the id of the modified element to a
list.

For example:
        <webuijsf:checkbox id="cb" label="cb"
        selected="#{Foo.cbSelected}"
        valueChangeListenerExpression="#{Foo.valueChanged}">
        </webuijsf:checkbox>

    public static void valueChanged(ValueChangeEvent event) {

    UIComponent component = (UIComponent)event.getSource();
    String id = component.getId();

    // add the id to your list..
   }
>
> Earlier we are using JATO components and used to have hiddenfield for
> each modifiable
> field .(eg:textfield) . Hiddenfield is used to store original value
> .By comparing hiddenfield value
> with textfield we can find whether field is modified or not.
>
> Regards,
> Vijay
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_woodstock.dev.java.net
> For additional commands, e-mail: users-help_at_woodstock.dev.java.net
>