FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » how to pass text set in a javascript?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: how to pass text set in a javascript? [message #178867 is a reply to message #178865] Thu, 16 August 2012 04:23 Go to previous messageGo to previous message
thejustpark is currently offline  thejustpark
Messages: 5
Registered: August 2012
Karma:
Junior Member
On Wednesday, August 15, 2012 9:09:47 PM UTC-5, Chuck Anderson wrote:
> thejustpark wrote:
>
>> Thank you guys so much!
>
>> I know that in order to answer this, you guys put your time and effort to read, think, and speak.
>
>> So I really appreciate this guys.
>
>>
>
>> I realize that some syntactic errors are in the page.
>
>> I don't have them in my code, but when I make up this example, I made such mistakes.
>
>> Below is the working example with the same problem.
>
>>
>
>> <script type="text/javascript">
>
>> <!--
>
>> function loadExample() {
>
>> document.forms["region"].elements['fgData'].value = "asdf";
>
>>
>
>> alert("asdf");
>
>> }
>
>> //-->
>
>> </script>
>
>>
>
>> <form name="region" action="calculator_sub.php" method="post" enctype="multipart/form-data" target="_self">
>
>> <textarea id="fgData" name="fgData" class="xxlarge" rows="10" disabled="disabled"> </textarea>
>
>> <input type="button" value="Example load" onclick="loadExample();">
>
>> <input type="submit" class="btn primary" id="submit_button" value="Submit">
>
>> </form>
>
>>
>
>> But in passing the argument to next.php, I see that '$_POST' doesn't deliver fgData to next.php,
>
>> as I have
>
>> <?php
>
>> echo "<pre>";
>
>> print_r($_POST);
>
>> echo "</pre>";
>
>> ?>
>
>> in next.php, there isn't even a variable named fgData.
>
>> What do you think I should look into?
>
>>
>
>> P.S. I kinda think it is related to php, because my understanding is that after the javascript function writes it to the textarea, it is php who should read and pass to next.php.
>
>>
>
>
>
> No. It's your browser that reads the form and sends a request to the
>
> server for your specified action, calculator_sub.php. Php does not run
>
> on the client. Php only runs on the server.
>
>
>
> And the browser is not posting the textarea value because the the
>
> textarea is disabled.
>
> (You could add -
>
> document.forms["region"].elements['fgData'].disabled=false - wherever
>
> you see fit, but this is strictly a JavaScript question, not Php.)
>
>
>
> --
>
> *****************************
>
> Chuck Anderson • Boulder, CO
>
> http://cycletourist.com
>
> Turn Off, Tune Out, Drop In
>
> *****************************

Oh thank you.
With your explanation, I finally get it pass the text!

Again thanks a lot!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHPUnit documentation
Next Topic: Create hierarchical tree structure for categories in joomla
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 19:36:28 GMT 2024

Total time taken to generate the page: 0.05008 seconds