This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validating dynamic forms

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a site where there will be multiple forms generated dynamically. How can I validate the fields in each of the forms if I don't know what fields will be present in each form. I should be able to use javascript but where do I start? I have done basic validating javascripts in the past any examples would be great also...
TIA,
Blake
 
Laojar Chuger
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Validation can be done both client side and server side depending on the business logic partition and security policy.
I guess you need exact form content as well as business logic to do any of the validations.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You just need to generate the validation in the same code which generates the fields. How you do this depends on what sort of validation you are doing. If it's just simple stuff like must-be -numeric you can put the validation in line in the field definition, or if it is more complex you may need a two-phase generation process which also generates some javascript "function" definitions at the top of the file or in a separate ".js" file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic