How to make a form generator script? Or dynamic generation script?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Samishii23
    New Member
    • Sep 2009
    • 246

    How to make a form generator script? Or dynamic generation script?

    By generator I mean, like MakeForm('Form1 '); pushes out a user password form. Then MakeForm('Form2 '); make form that adds Car data information into a DB?
    That kind of thing.

    I was originally thinking about a "String" parser like this: "fName=Name|fTy pe=Text|fSize=1 3|fMaxLen=25|". Would print out a <input> tag with the above listed parameters.

    Anyone have a thought on this?

    Cause my project is gonna have atleast 20 forms or more. And i'd rather have a dynamic maker / parser / etc, then 20+ individual form functions or w/e. It feels sloppy and not well made.
  • JKing
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    I don't really see the value in this. It seems like a lot of effort for very little gain.

    Why would you have 20+ individual form functions?

    Comment

    • Samishii23
      New Member
      • Sep 2009
      • 246

      #3
      Well. When I developed my mock-up for a project of mine, I made a 1 function for everything just to get the idea or how everything will work, and display properly and all that. Plus it was to show the customer.

      But what I see in this, value wise, is that instead of having an individual form for each feature / function of the project, have something that generates the form on demand.

      You being way more experienced then myself. If you had a project that had many forms in it, how would you go about it?

      Comment

      • JKing
        Recognized Expert Top Contributor
        • Jun 2007
        • 1206

        #4
        Would your function be purely for outputting the HTML required for the forms? Also if you are taking in all the parameters for each element on the form you are essentially typing the entire form element out except the input tag itself and some quotes?

        Without knowing more about your requirements it is hard to say but in general I would have a page with my form and a separate page that processes that form.

        Comment

        • Samishii23
          New Member
          • Sep 2009
          • 246

          #5
          Yes it would be purely HTML.
          Sorry for the late reply. I was putting together my forms ( it took this long because I procrastinate a lot.

          I'm missing two forms right now. One of them will be the more complicated of them all, and I'm debating how to do it still.

          Tell me JKing. Does this "Style" work for you? Or would you do this differently? This is the most "Compact" I can make it right now with out having a form generator. Even still it would be 'fun'... lol

          Though I was debating on one way to make the forms was to basicly scan the db tables for type / len to do some processing based on that. Still mulling over the possibilities.
          Attached Files

          Comment

          Working...