The JS is working AOK....you just havent asked it to put the value in the
hidden field....try this and you will see what I mean.. watch the wrapping
;-)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


<html>
<head>
<title>Untitled</title>

<cfparam name="FORM.outputselection" type="any" default="">


<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>


</head>


<body>


<form action="" method="post" name="frm" id="frm">


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

<cfif StructCount(form) GT 0>
<cfdump var="#form#">
<cfelse>
<cfdump var="#form#">
</cfif>


</body>
</html>

-----Original Message-----
From: Ben Doom [mailto:[EMAIL PROTECTED]
Sent: 20 October 2003 15:13
To: CF-Talk
Subject: Re: Form and hidden variable question

The source you see is what is actually fed to the browser (typically,
anyway).  The JS changes what's in the browser's memory, but not what it
thinks the source is.  This is not really any different from the fact
that, when you type something into a textbox, it doesn't change the
source display.

It sounds like the JS is working correctly.  Check the value of the
contents on the action page to see if what you want is really getting
through.

--BenD

Allan Clarke wrote:

> 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 <http://shopping.yahoo.com>
>
  _____  


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

Reply via email to