Hi,
Yes, you need to use a larger scope than request for your use case. What
happen more specifically is the following:
1. Click the checkbox;
2. PPR launches and set the request managed bean's check property to true;
3. The inputTexts are rerendered;
4. The managed bean is destroyed as the request scope is released;
5. Click submit;
6. During Apply request values, the managed bean is recreated (since it's
request scoped) with check property set to false;
7. Last name field looks like it's read only since the check property is set
to false, so the submitted request parameter is ignored;
8. During update model, the check get its value updated to true from the
checkbox's submitted value;
9. The last name is never updated as the submitted value was ignored during
a preceding phase, even if it's now no longer read only.
Hope it make it decently clear,
~ Simon
On Tue, Jul 1, 2008 at 2:24 PM, Justin Mckay <[EMAIL PROTECTED]> wrote:
> I have a page where I have a check box if it is unchecked first name
> appears as an inputtextfield if checked we ppr the page hiding the first
> name and showing the last name as an inputtext field. Below is a submit
> button. If I check the check box and enter a last name when I submit and
> get to the action in the backing bean the Boolean value is correctly set to
> true but the last name is still null. Here is the sample code:
>
>
>
> *public* *class* CheckTest {
>
> *private* *boolean* check;
>
> *private* String firstName;
>
> *private* String lastName;
>
>
>
> *public* String *save()*
>
> {
>
> System.*out*.println(firstName);
>
> System.*out*.println(lastName);
>
> }
>
>
>
> /**
>
> * [EMAIL PROTECTED] the check
>
> */
>
> *public* Boolean getCheck() {
>
> *return* check;
>
> }
>
>
>
> /**
>
> * [EMAIL PROTECTED] check the check to set
>
> */
>
> *public* *void* setCheck(Boolean check) {
>
> *this*.check = check;
>
> }
>
>
>
> /**
>
> * [EMAIL PROTECTED] the firstName
>
> */
>
> *public* String getFirstName() {
>
> *return* firstName;
>
> }
>
>
>
> /**
>
> * [EMAIL PROTECTED] firstName the firstName to set
>
> */
>
> *public* *void* setFirstName(String firstName) {
>
> *this*.firstName = firstName;
>
> }
>
>
>
> /**
>
> * [EMAIL PROTECTED] the lastName
>
> */
>
> *public* String getLastName() {
>
> *return* lastName;
>
> }
>
>
>
> /**
>
> * [EMAIL PROTECTED] lastName the lastName to set
>
> */
>
> *public* *void* setLastName(String lastName) {
>
> *this*.lastName = lastName;
>
> }
>
> }
>
>
>
> jsf code:
>
>
>
> <tr:panelFormLayout partialTriggers=*"test"*>
>
> <tr:selectBooleanCheckbox id=*"test"* label=*"Test Me"*
> value="#{checkTestBean.check}"
> autoSubmit=*"true"*/>
>
> <tr:inputText label=*"First Name"* value="#{checkTestBean.firstName}"
> readOnly="#{checkTestBean.check}" />
>
> <tr:inputText label=*"Last Name"* value="#{checkTestBean.lastName}"
> readOnly="#{not checkTestBean.check}" />
>
> <tr:commandButton text=*"Submit"* action="#{checkTestBean.save}"/>
>
> </tr:panelFormLayout>
>
>
>
> If I take the same code and put the Boolean value in the process scope it
> works as expected. Do we have to use the process scope for a situation like
> this or am I missing something?
>
>
>