You do a submit without action attribute, thus the page itself is
reloaded. This means that any of the changes made to the page by the js
are lost when you submit. You should see the var form.outputselection if
you dump the form vars after submit.


Pascal
-----Original Message-----
From: Allan Clarke [mailto:[EMAIL PROTECTED]
Sent: maandag 20 oktober 2003 15:44
To: CF-Talk
Subject: Form and hidden variable question

Hi Guys,

I desparately need somebody to help me. I have a form
which has hidden variable, a textarea and a submit
button. When the submit button is clicked a OnClick
event calls a function subme() method. Here is my code

<form name="frm" method="post">
<input NAME="update" TYPE="submit"
VALUE="Calculate">
<textarea name="txtarea1" cols="40"
rows="5"></textarea>
<input type="hidden" name="outputselection" value="">
</form>

Here is the javacript code:

<script LANGUAGE="_javascript_">
function subme() {
method1();
document.frm.outputselection.value = PagecontentA +
PagecontentB + PagecontentC;
alert(document.frm.outputselection.value);
document.frm.submit();
}

function method1(){
PagecontentA ="Hello";
PagecontentB ="And";
PagecontentC ="Welcome";
}

</script>

When browsed in the browser on form submission the
alert displays the value "Hello And Welcome" but for
some reason when I view the source in the browser the
value of the hidden variable "outputselection" is
empty. I want to populate the textbox with the value
in the hidden variable. I am struggling to do this.
Can somebody please show me how to do this, I would
really appreciate your help

Best Regards,
Allan

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to