You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Eric Kelm <er...@vsgadmin.com> on 2005/08/04 15:31:28 UTC

Problem with commandButton and required form fields

Hi all,

I am having a problem with a form in an application I am working on and was
wondering if anyone else had the problem.  I have a large form that is part
of a tabbed pane, where there are many form fields that are required
(required="true"). Within this form I have a place where a user can enter
information in 2 of the form fields and click an "Add" button which adds
values from the 2 form fields to a backing bean.  The problem lies in that
if any of the other fields on the form are required, this "add" function
will fail due to failed form validations.  I cannot make the "Add" button
immediate="true" because this bypasses the apply request values phase if I
understand correctly. Any suggestions would be appreciated.  Thanks in
advance. Hope this makes sense.


---------
Eric Kelm
Developer, VSG Worldwide LLC
510 Spur 63
Longview, TX 75601





Re: Problem with commandButton and required form fields

Posted by Mike Kienenberger <mk...@gmail.com>.
Just came across something that might make this a lot easier:

===============
Components that implement EditableValueHolder (such as UIInput), and
whose immediate property is set to true, will cause the conversion and
validation processing (including the potential to fire ValueChangeEvent events)
that normally happens during Process Validations phase to occur during Apply
Request Values phase instead.
===============

On 8/4/05, Eric Kelm <er...@vsgadmin.com> wrote:
> I figured out a way to get this to work. I have the immediate value for the
> button set to immediate="true" and then I created an actionListener that
> populates the backing bean with the values manually. Hope this helps.
> 
> ---------
> Eric Kelm
> Developer, VSG Worldwide LLC
> 510 Spur 63
> Longview, TX 75601
> 
> 
> 
> ->-----Original Message-----
> ->From: Mike Kienenberger [mailto:mkienenb@gmail.com]
> ->Sent: Thursday, August 04, 2005 4:07 PM
> ->To: MyFaces Discussion
> ->Subject: Re: Problem with commandButton and required form fields
> ->
> ->I don't have any answers yet, but I'm having the same issue.
> ->
> ->On 8/4/05, Eric Kelm <er...@vsgadmin.com> wrote:
> ->> Hi all,
> ->>
> ->> I am having a problem with a form in an application I am working on and
> ->was
> ->> wondering if anyone else had the problem.  I have a large form that is
> ->part
> ->> of a tabbed pane, where there are many form fields that are required
> ->> (required="true"). Within this form I have a place where a user can
> ->enter
> ->> information in 2 of the form fields and click an "Add" button which adds
> ->> values from the 2 form fields to a backing bean.  The problem lies in
> ->that
> ->> if any of the other fields on the form are required, this "add" function
> ->> will fail due to failed form validations.  I cannot make the "Add"
> ->button
> ->> immediate="true" because this bypasses the apply request values phase if
> ->I
> ->> understand correctly. Any suggestions would be appreciated.  Thanks in
> ->> advance. Hope this makes sense.
> ->>
> ->>
> ->> ---------
> ->> Eric Kelm
> ->> Developer, VSG Worldwide LLC
> ->> 510 Spur 63
> ->> Longview, TX 75601
> ->>
> ->>
> ->>
> ->>
> ->>
> 
>

Re: Problem with commandButton and required form fields

Posted by Mike Kienenberger <mk...@gmail.com>.
Yeah, it looks like the two options are:

1) parse out the form values yourself
2) create an alternate lifecycle that conditionally skips the validation phase.

Have you found any shortcuts for pulling in and populating the form
values?  Seems like a lot of duplication of JSF functionality.

On 8/4/05, Eric Kelm <er...@vsgadmin.com> wrote:
> I figured out a way to get this to work. I have the immediate value for the
> button set to immediate="true" and then I created an actionListener that
> populates the backing bean with the values manually. Hope this helps.
> 
> ---------
> Eric Kelm
> Developer, VSG Worldwide LLC
> 510 Spur 63
> Longview, TX 75601
> 
> 
> 
> ->-----Original Message-----
> ->From: Mike Kienenberger [mailto:mkienenb@gmail.com]
> ->Sent: Thursday, August 04, 2005 4:07 PM
> ->To: MyFaces Discussion
> ->Subject: Re: Problem with commandButton and required form fields
> ->
> ->I don't have any answers yet, but I'm having the same issue.
> ->
> ->On 8/4/05, Eric Kelm <er...@vsgadmin.com> wrote:
> ->> Hi all,
> ->>
> ->> I am having a problem with a form in an application I am working on and
> ->was
> ->> wondering if anyone else had the problem.  I have a large form that is
> ->part
> ->> of a tabbed pane, where there are many form fields that are required
> ->> (required="true"). Within this form I have a place where a user can
> ->enter
> ->> information in 2 of the form fields and click an "Add" button which adds
> ->> values from the 2 form fields to a backing bean.  The problem lies in
> ->that
> ->> if any of the other fields on the form are required, this "add" function
> ->> will fail due to failed form validations.  I cannot make the "Add"
> ->button
> ->> immediate="true" because this bypasses the apply request values phase if
> ->I
> ->> understand correctly. Any suggestions would be appreciated.  Thanks in
> ->> advance. Hope this makes sense.
> ->>
> ->>
> ->> ---------
> ->> Eric Kelm
> ->> Developer, VSG Worldwide LLC
> ->> 510 Spur 63
> ->> Longview, TX 75601
> ->>
> ->>
> ->>
> ->>
> ->>
> 
>

RE: Problem with commandButton and required form fields

Posted by Eric Kelm <er...@vsgadmin.com>.
I figured out a way to get this to work. I have the immediate value for the
button set to immediate="true" and then I created an actionListener that
populates the backing bean with the values manually. Hope this helps.

---------
Eric Kelm
Developer, VSG Worldwide LLC
510 Spur 63
Longview, TX 75601



->-----Original Message-----
->From: Mike Kienenberger [mailto:mkienenb@gmail.com]
->Sent: Thursday, August 04, 2005 4:07 PM
->To: MyFaces Discussion
->Subject: Re: Problem with commandButton and required form fields
->
->I don't have any answers yet, but I'm having the same issue.
->
->On 8/4/05, Eric Kelm <er...@vsgadmin.com> wrote:
->> Hi all,
->>
->> I am having a problem with a form in an application I am working on and
->was
->> wondering if anyone else had the problem.  I have a large form that is
->part
->> of a tabbed pane, where there are many form fields that are required
->> (required="true"). Within this form I have a place where a user can
->enter
->> information in 2 of the form fields and click an "Add" button which adds
->> values from the 2 form fields to a backing bean.  The problem lies in
->that
->> if any of the other fields on the form are required, this "add" function
->> will fail due to failed form validations.  I cannot make the "Add"
->button
->> immediate="true" because this bypasses the apply request values phase if
->I
->> understand correctly. Any suggestions would be appreciated.  Thanks in
->> advance. Hope this makes sense.
->>
->>
->> ---------
->> Eric Kelm
->> Developer, VSG Worldwide LLC
->> 510 Spur 63
->> Longview, TX 75601
->>
->>
->>
->>
->>


Re: Problem with commandButton and required form fields

Posted by Mike Kienenberger <mk...@gmail.com>.
I don't have any answers yet, but I'm having the same issue.

On 8/4/05, Eric Kelm <er...@vsgadmin.com> wrote:
> Hi all,
> 
> I am having a problem with a form in an application I am working on and was
> wondering if anyone else had the problem.  I have a large form that is part
> of a tabbed pane, where there are many form fields that are required
> (required="true"). Within this form I have a place where a user can enter
> information in 2 of the form fields and click an "Add" button which adds
> values from the 2 form fields to a backing bean.  The problem lies in that
> if any of the other fields on the form are required, this "add" function
> will fail due to failed form validations.  I cannot make the "Add" button
> immediate="true" because this bypasses the apply request values phase if I
> understand correctly. Any suggestions would be appreciated.  Thanks in
> advance. Hope this makes sense.
> 
> 
> ---------
> Eric Kelm
> Developer, VSG Worldwide LLC
> 510 Spur 63
> Longview, TX 75601
> 
> 
> 
> 
>