#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2011
    Posts
    14
    Rep Power
    0

    Is reusablity applicable in html forms?


    hi,

    what would be the best way to avoid duplicate code in html forms?

    e.g. a students application form to a school. it would have different sections like personal info, address, hobbies.

    ON ONE VERSION OF THE APPLICATION FORM.
    a single page should contain everything, all the sections.

    ON THE SECOND VERSION,
    it should be like a wizard type of data input. so each section would have each a separate page.

    ***************************

    now my concern is, is it possible to avoid repetition of code in this situation? in case I have to implement both of the types of application forms, there is definitely repetition because I have to write code for the wizard type and the one page application form. AND ANOTHER PROBLEM, if the maxlength of an input field changes, then I have to change both of the input fields that would change from the wizard type and the 1 page application form.

    how can this be addressed? how can I get out of this maintenance nightmare?

    suggestions would be very much appreciated.


    sincerely,
    simon
  2. #2
  3. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,102
    Rep Power
    1990
    The easy way to do this is to write each piece of the form in a seperate file and include the section/sections that you need for each process. In the wizard you'll include one file each time, and in the full form you'll include all of them.

    Comments on this post

    • chessmonst agrees
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2011
    Posts
    14
    Rep Power
    0
    hey,

    thanks for the tip. , I get to think too much I forget about the basic stuff.

    again, thank you.


    sincerely,
    simon
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2011
    Posts
    14
    Rep Power
    0
    by the way, is this possible to do with just pure html? without using jsp,asp or php?
  8. #5
  9. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    No
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2011
    Posts
    14
    Rep Power
    0
    Originally Posted by E-Oreo
    No
    well that is a concise answer, anyway thanks

    and how do you do the third attempt on that flash drive?
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2010
    Location
    Florida
    Posts
    46
    Rep Power
    4
    Well for create different files and include it is the right option for that but it is not possible to do with pure HTML, you have to use any other server side scripting language like PHP, ASP

IMN logo majestic logo threadwatch logo seochat tools logo