• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing struts Bean property in javascript

 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. I have a textbox called amt which has a validation to accept only numbers with one decimal point.
2. I use struts tags for the textbox and javascript to perform the validation
3. Struts code:

4. Javascript code:

5. The above validation works for numbers but I have to put a validation for only one decimal point.
6. I want to use the folowing approach:
Use a regular expression like
But how do I call the bean property in javascript and match the value with the regular expression.
For HTML textbox,I can use but how does it work in struts.
7. Is there any other approach.


Please help me resolve this.
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Hasini,
Once after reaching Client, it is no more struts and its just HTML. Since you need onfly validation, you can try using getting the element by name. It should be available in the document. Additionally, you can include the same in reg exp in validation.xml for form submission.
 
reply
    Bookmark Topic Watch Topic
  • New Topic