URGENT: Access a form variable
Hi all,
How can i access a form's variable from outside the form.
e.g.
<form name="form1">
<input type="hidden" name="abc" value="123">
</form>
<cfset A_Variable = ______________________>
what should i put here?
please help, thank you very much!
Vincent Puglia posted this at 18:44 — 5th June 2000.
They have: 634 posts
Joined: Dec 1999
Hi,
The usual method is:
var x = document.formname.elementname.value;
it shouldn't be any different in coldFusion, so:
<cfset a_variable = document.form1.abc.value;>
If that doesn't work, within the textbox's tag, try: onBlur="x = this.value">
then assign x to a_variable.
Vinny
------------------
my site:GrassBlade: cut&paste javascript
moderator at:The Javascript Place
Javascript City
Where the world once stood
the blades of grass cut me still
che_wwong posted this at 07:01 — 6th June 2000.
They have: 15 posts
Joined: Jun 2000
Thanks for helping, Vinny
I've tried that but it still doesn't work.
I was wondering if the code below might make things clearer:
Page1.cfm
----------
:
:
<script language="javascripts">
<!--
function openLocationWindow(form){
newLocationWindow = window.open("TopView1.cfm", "myWindow", "scrollbars=yes, width=600, height=500");
newLocationWindow.document.forms.Form_Location.Location.value = form.HardcopyLocationID.value;
}//-->
</script>
:
:
TopView1.cfm
------------
:
:
<form name="Form_Location">
<input type="text" name="Location">
:
:
</form>
<cfset A_Variable = ___________________>
Question: How to assign the value of "Location" of the "Form_Location" form to "A_Variable"?
Please Help! Thank you very much
che'
Vincent Puglia posted this at 02:25 — 7th June 2000.
They have: 634 posts
Joined: Dec 1999
Hi che,
I don't have my Cold Fusion book with me, but I seem to recall an example such as:
<cfset pi = 3.14....
The implication was that assignments are the same:
<cfset a_variable = document.Form_Location.Location.value;>
or
var x = document.Form_Location.Location.value;
<cfset a_variable = x;>
However, I am curious about the following assignment. Is is correct?
newLocationWindow.document.forms.Form_Location.Location.value = form.HardcopyLocationID.value;
I ask because you seem to have an extra "forms" on the left side of the equals sign.
If this doesn't help, perhaps you should post in the database or other programming language sections.
Vinny
------------------
my site:GrassBlade: cut&paste javascript
moderator at:The Javascript Place
Javascript City
Where the world once stood
the blades of grass cut me still
che_wwong posted this at 08:59 — 7th June 2000.
They have: 15 posts
Joined: Jun 2000
Thank you very much Vinny.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.