• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Ignore server side validation

 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmmm....could you use 'immediate=true' for this situation?

-Cameron McKenzie
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply ,
could you please describe it more .

regards,
S
 
Saloon Keeper
Posts: 28405
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried what you told , but it is not working.

Thanks,
S
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic