users@woodstock.java.net

Asynchronously submit and refresh. How to?

From: Stefan Bley <stefan.bley_at_saxsys.de>
Date: Mon, 19 May 2008 07:32:05 -0700 (PDT)

Hi woodstock users,

I'd like to put new elements in a dropdown when another dropdown's selection
has changed.
Which elements are put inside is dependent on the values of a calendar and a
text field.

I tried this:

<webuijsf:script>
function handleDd1Change() {
                                var dd1 =
document.getElementById('form1:dd1');
                                var dd2 =
document.getElementById('form1:dd2');
                                var cal1 =
document.getElementById('form1:cal1');
                                var txt1 =
document.getElementById("form1:txt1");

                                dd1.submit("form1:cal1,form1:txt1");
                                dd2.refresh("form1:dd1");
                            }
</webuijsf:script>

<webuijsf:dropDown id="dd1" items="#{Bean.dd1DefaultOptions.options}"
onChange="setTimeout('handleDd1Change();',0)" selected="#{Bean.dd1Value}"
valueChangeListenerExpression="#{Bean.dd1_processValueChange}" />
<webuijsf:dropDown id="dd2" items="#{Bean.dd2DefaultOptions.options}"
selected="#{Bean.dd2Value}" />
<webuijsf:calendar id="cal1" selectedDate="#{Bean.cal1Value}" />
<webuijsf:textField id="txt1" text="#{Bean.txt1Value}" />

In the bean I have:

public void dd1_processValueChange(ValueChangeEvent event) {
        setNewValuesForDd2(event.getNewValue(), getCal1Value(),
getTxt1Value());
    }

However, the values of getCal1Value() and getTxt1Value() are both null! I
thought when I put their component id's in dd1's submit method, the backing
bean's values are updated. Do I miss something?

Thanks for help, Stefan
-- 
View this message in context: http://www.nabble.com/Asynchronously-submit-and-refresh.-How-to--tp17316746p17316746.html
Sent from the Project Woodstock - Users mailing list archive at Nabble.com.