Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Formular data exchange: Is the code cleanly HTML?

Reply
Thread Tools

Formular data exchange: Is the code cleanly HTML?

 
 
Markus Stein
Guest
Posts: n/a
 
      01-13-2008
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.textf eld.value">
</p>
</form>


</body>
</html>
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      01-13-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
firefox doesn't show a formular lukas.zierer@gmail.com HTML 17 07-29-2006 10:41 AM
choice of URL and CD drive by formular Wanadoo HTML 0 06-18-2006 03:22 PM
Applet launched from a Web base formular Maldo Java 0 02-27-2006 10:57 AM
HTML Formular question Clemens Richter HTML 1 11-07-2003 07:34 PM
force a formular just to take numbers Jochen Fuhrmann HTML 9 10-05-2003 09:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57