Hi,
In a function within my head tags, I build a variable called orderinfo.
All I want is to set the value of one of my form textboxes to be this variable. Seems simple enough.
I've tried putting a "form.textbox.value = orderinfo" and that does nothing
I've tried putting a document.write for the javascript value inside the value="", and that does nothing.
Can someone guide me in the right direction?
Josh
RESOLVED - Simple Javascript Form Problem
Moderator: General Moderators
-
sell-traffic
- Forum Commoner
- Posts: 26
- Joined: Thu Aug 05, 2004 9:35 pm
RESOLVED - Simple Javascript Form Problem
Last edited by sell-traffic on Mon Sep 13, 2004 5:16 pm, edited 1 time in total.
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
1) This question should really should be in the Client Side forum not PHP Code.
2) OK why just javascript (Is this pure javascript or php as well) ?
Possible answer. Build the page (I assume the form has a name as well as the actual textbox).
On the body HTML tag have the following:
Disadvantage of this is that the value will overwrite the "POST" or "GET" variable.
This has been stated many times but I will reiterate it here.... Some users will DISABLE JAVASCRIPT. It makes more sense to have the server build all the necessary information which a user requires (PHP). Javascript can then be used to validate a form or do fancy things, but you need to already have the information from the server.
2) OK why just javascript (Is this pure javascript or php as well) ?
Possible answer. Build the page (I assume the form has a name as well as the actual textbox).
On the body HTML tag have the following:
Code: Select all
<body onload="javascript:document.formname.textboxname.value=variablename;">This has been stated many times but I will reiterate it here.... Some users will DISABLE JAVASCRIPT. It makes more sense to have the server build all the necessary information which a user requires (PHP). Javascript can then be used to validate a form or do fancy things, but you need to already have the information from the server.
Last edited by CoderGoblin on Mon Sep 13, 2004 9:01 am, edited 1 time in total.
-
sell-traffic
- Forum Commoner
- Posts: 26
- Joined: Thu Aug 05, 2004 9:35 pm