wood burning stoves 2.0*
The moose likes JSF and the fly likes Ignore server side validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Ignore server side validation" Watch "Ignore server side validation" New topic
Author

Ignore server side validation

S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 244
Hi every body , I have a problem ,

I have a phone number field , that is being validated by JSF's validation.I have written one phone nunber validation .It is working fine .
I have one clear button also.If user dont want to put any value , (s)he may press the clear button.
But the problem is suppose user put some invalida phone number & press the clear button , the JSF is showing invalid phone number.But I dont want to do any type of validation , when user click the clear button.


Here is my JSF code :



Please help.

Thanks ,
S
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Hmmmm....could you use 'immediate=true' for this situation?

-Cameron McKenzie
S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 244
Thanks for your reply ,
could you please describe it more .

regards,
S
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

Unless you actually need to update the backing bean instead of just the displayed data, you can use JavaScript.

I think it goes like this:


I think you have to return false to make this a client-side only operation (cancels form submit). And the ID has to reflect the "true" ID of the PhoneField, not the JSF id. If in doubt, do a "view page source" on the rendered page to see what that is. It should be a composite of the control's ID plus the containing naming containers. If you see any generated names, put an ID on the container or you'll have problems, since generated names can vary unpredictably.


Customer surveys are for companies who didn't pay proper attention to begin with.
S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 244
I have tried what you told , but it is not working.

Thanks,
S
S Majumder
Ranch Hand

Joined: Jun 03, 2009
Posts: 244
Thanks again Mr.Tim Holloway for your reply ,

But the problem is when user click the clear button , I have to clear the text field (phone field) .So I think for clear button event I have to post to the server & clear the text field.


regards,
S
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ignore server side validation
 
Similar Threads
Ajax call, backing bean and validation
Enable dynamic inputText
InputText event handling problem
Validation Problem ... again!
ajax4jsf and h:inputText