Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

issue with Validation  RSS feed

Rammohan Bandakunta
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some javascript Functions which are for basic validations like length ,numeric but I have some set of Rules that I need to Fetch in, when a dropdown is selected in the Front End,thus the length rules changes with mask and other parameters.

1>should i store these Rules in the Database and Fetch using DAO in to Action Form and the Front End.
2>should i Hardcode all the Function in the Front end and validate onChange submit with the Dropdown.

or Can I use the Validaation Framework which struts seems to offer,I am not sure how the validation Framework really works.

Suggest please..

I made the required changes in struts-config ,validation and validation-rules.xml

issue is when i change the value in the drop down for a perticular field the Min and Max length value should change and the field should validate against the updated value.
ex:if for a perticular value (a) in the Dropdown the length against which a serial number field is validated is 10,on changing or selecting the value in the dropdown to (b) the length against which serialnumber field should be validated is 20,

Any thoughts about how i need to submit the value on change in to the validation.xml

In struts validation whats the best way to implement this
<TD height="39" width="106">ApplicationType</TD>
<TD height="39" width="179"><html:select name="micrtoolhomeCBForm"
onchange="javascript ocument.forms[0].submit()">
<html ptions collection="applicationTypeList" property="value"
labelProperty="label" />
if (decknumber==null || decknumber.length==0){

alert("Please enter DeckName ")
return false;
else if(decknumber.length>10) {
alert("Please enter deckname < 10 char...")
return false;
else if (serialnumber==null || serialnumber.length==0)
alert("please enter SerialNumber.")
return false;
else if(serialnumber.length>10 ) {
alert("Please enter serialnumber < Serial Length Rule For Selected AppType")
return false;
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!