Announcement

Collapse
No announcement yet.

input from: how do I do this?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • input from: how do I do this?

    Hello,

    I'm making a website for my brother. There should now be an inputform, and I'd like it to contain something like this:
    Code:
    INPUTBOX1
    add_button
    When the button is clicked, there should appear a second inputbox:
    Code:
    INPUTBOX1
    INPUTBOX2
    add_button
    Any ideas how I can do this?
    (it is not a very important thing, but I think it would be nicer than to just have a fixed number of inputboxes)

    Perhaps removing an inputbox might also be interesting (if possible with a remove button next to each inputbox)...


    Jörg
    pixar
    Dream as if you'll live forever. Live as if you'll die tomorrow. (James Dean)

  • #2
    There's a few ways to go about this. If you can use PHP or ASP (etc) then it's possible to add the additional input fields upon each submittion of the form. Otherwise, you can use Javascript to dynamically add additional input fields (this can be quirky).
    “And, remember: there's no 'I' in 'irony'” ~ Merlin Mann

    Comment


    • #3
      I'd go with jesterzwild's suggestion of having it add the extra row on submit, (not javascript) well not submit, have a seperate submit button next to the first input box, this can then refresh the page and increment $i by 1.

      All you would need to do then is using a for() loop to display the input boxes.

      A form I created for a project a while ago needed this feature, I used a drop down menu at the time, I knew there where never going to be more then a certain number of boxes. Easier to use as well, if you wanted 10 inputs you would have to click the button 9 times whilst with a drop down menu, always one click.

      Comment


      • #4
        Myes, but I think if I put 3 inputboxes to start with, it will be satisfactory for most uses. The user that needs more boxes could then always click the add button.

        There is a problem though: I have little experience with Javascript (I'm learning as I make this site) and with scripting languages...
        So are there any examples to get me started?


        Jörg
        Last edited by VJ; 15 November 2004, 07:38.
        pixar
        Dream as if you'll live forever. Live as if you'll die tomorrow. (James Dean)

        Comment


        • #5
          A kludge would be to have 10 fields, and use DIVs to rewrite that part of the page. I can dig out an example if you need it; it was something like "are you a student", if yes is clicked then "are you in our department" would appear.
          FT.

          Comment


          • #6
            Could you find that example?
            Pleeeeaaase?



            Jörg
            pixar
            Dream as if you'll live forever. Live as if you'll die tomorrow. (James Dean)

            Comment


            • #7
              Sure - check your PM
              FT.

              Comment


              • #8
                Thanks! I just quickly glanced at the source, and chances are it will be of help.
                I'm not sure yet how I will name the inputboxes (array or not), but I'll see how it works out.
                (if it doesn't, I know where to post... )

                Jörg
                pixar
                Dream as if you'll live forever. Live as if you'll die tomorrow. (James Dean)

                Comment

                Working...
                X