• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Design suggestion please.....

 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
I just started off learning XML and realted stuff and today I have been asked to design a flexible form as a part of my project.
The problem is something like this..
The user should be able to specify the fields (not fixed) which
he wants in the HTML file on runtime. he w'd also specify the validation needed on those fields. I s'd be able to design something to generate that HTML form on runtime. Okay , i can smell XML somewhere here ....It w'd be great if you guys c'd tell me if i'm on the right track. Ofcourse i'm not asking for a solution !..i have this feeling that the user c'd probably specify such things in an XML file?? I can already see some classes like
class HTMLGenerator extends ... etc
..long way to go..eagerly awaiting your responses.
thanks in advance,
karthik.
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If something is to be validated, you should always keep the data in attributes instead of element values. This is because of the limited expression power of DTD, and will (they say) be no problem in future schema languages such as XML Schema.
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. The task at hand is to generate an HTML file dynamically with the fields selected by user. Some of the fields may require validation.
What kind of validation are we talking about?? Semantic validation or just input content validation??
You should try to incorporate as much validation you can in the HTML itself. Constraints like field size, input masks etc can be easily implemented at the HTML level and they also save you quite a lot of on submit validation.
If you need more complex validation that requires table lookups or data-set integrity check involving two or more user enetered data, consider writing a validating application component.
You can use XML to persist the user selctions. If the user is expected to come back and retrieve one or more of his previous forms, XML can be used for this purpose. While it is fairly easy to represent primitive( widget-level ) validation rules like length, mask etc, representing the complex semantic and/or cross-field validation rules is going to be quite a challenging task.
DTDs can help you validate instances of XML document with respect to a standard blueprint. However in your case since the user can select any arbitrary number of widgets and optionally associate rules with each of them, using DTDs may not help you much.
Good luck,

------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!