Formular data exchange: Is the code cleanly HTML?

Discussion in 'HTML' started by Markus Stein, Jan 13, 2008.

  1. Markus Stein

    Markus Stein Guest

    In a previous thread I asked "How to exchange data between forms in one document with pure HTML"?

    Now I find a solution not with pure HTML but with a little bit of Javacript
    (onclick="this.form.textfeld.value='...'). But I have not a question
    about JavaScript but about the correctness of my code.

    It works. But is it also correct?

    Is it Standard HTML that I can see in a form the variables
    that I have defined in another form?

    This works with FF1.5 and IE7:

    <html>
    <head>
    <title>Formular-Test</title>
    </head>
    <body>
    <h3>Formular Test</h3>

    <h3>Formular 1</h3>
    <form name="Formular1" action="input_button.htm">
    <p>
    <textarea cols="20" rows="4" name="textfeld"></textarea>
    <input type="button" name="Text 1" value="Show text 1"
    onclick="this.form.textfeld.value='ABC'">
    <input type="button" name="Text 2" value="Show text 2"
    onclick="this.form.textfeld.value='123'">
    </p>
    </form>

    <h3>Formular 2</h3>
    <form name="Formular2" action="input_button.htm">
    <p>
    <textarea cols="20" rows="4" name="textfeld2"></textarea>
    <input type="button" name="Text 3" value="Show Textarea from formular 1"
    onclick="this.form.textfeld2.value=Formular1.textfeld.value">
    </p>
    </form>


    </body>
    </html>
     
    Markus Stein, Jan 13, 2008
    #1
    1. Advertising

  2. Markus Stein wrote:
    > In a previous thread I asked "How to exchange data between forms in one
    > document with pure HTML"?
    >
    > Now I find a solution not with pure HTML but with a little bit of Javacript
    > (onclick="this.form.textfeld.value='...'). But I have not a question
    > about JavaScript but about the correctness of my code.
    >
    > It works. But is it also correct?


    *IF* JavaScript is enabled, but whether or not JavaScript is enabled on
    the client's computer is *not* in your control. Therefore if this is
    required for the page to function, then the answer is "no", it is not
    correct. What would be correct is to use JavaScript if available, but
    also provide a fallback if it is not. The fallback would require the
    user to submit the form and a server-side script would fill in the value
    for the second form when it rebuilds the page. Note however that a
    server-side script will only receive values from a single form, the one
    submitted...

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Jan 13, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kerry Shetline
    Replies:
    2
    Views:
    454
  2. Clemens Richter

    HTML Formular question

    Clemens Richter, Nov 7, 2003, in forum: HTML
    Replies:
    1
    Views:
    477
    Steve Pugh
    Nov 7, 2003
  3. Tim Bradshaw
    Replies:
    2
    Views:
    281
    David Fraser
    May 27, 2004
  4. Jon Wright
    Replies:
    2
    Views:
    412
    Jon Wright
    Oct 22, 2004
  5. =?ISO-8859-15?Q?Manfred_Preu=DFig?=

    formular problem in html project

    =?ISO-8859-15?Q?Manfred_Preu=DFig?=, Apr 18, 2007, in forum: HTML
    Replies:
    1
    Views:
    386
    Jonathan N. Little
    Apr 18, 2007
Loading...

Share This Page