JavaScript.CoolDev.Com Support Forums

Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Trouble with COOLjsTree and PHP form

 
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsTree
Author Message
luke



Joined: 15 Jun 2004
Posts: 3

PostPosted: Tue Oct 05, 2004 1:51 am    Post subject: Trouble with COOLjsTree and PHP form Reply with quote

Hi,

I've created a form in PHP that is controlled by COOLjsTree. You can see what I've got by going to

http://www.window.auckland.ac.nz/proposal.html

And clicking the 'OnSite' link near the top to go the the form I'm having difficulties with.

This isn't a PHP problem because I've posted to a PHP help forum and they said the problem would be with the JavaScript.

I've got some brief PHP if statements checking that the required fields were filled out after the 'Review' button is pushed, and if not, the form reloads with what the user previously entered into the fields. The issue is that if someone hits the 'enter' button when writing something in the textarea boxes to start a new line in the textarea box, after which if you hit the 'Review' button the form fails to load! It seems such a strange thing to trip everything up.

An example of the PHP code to catch the POST information is below:


Code:
<textarea name=postal_address rows=4>
<?php if ($_POST['postal_address'] !="") { 
echo $_POST['postal_address']; 
} ?>
</textarea>


I'm wondering if anyone knows what the JavaScript would be conflicting with the PHP in this situation

Thanks
Luke
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Wed Nov 17, 2004 7:43 pm    Post subject: Reply with quote

If you want to pass multiline string via JavaScript (e.g. as a node's caption in tree_nodes.js), you should use double quotes and "\n" special sequence, e.g.:
Code:
["<textarea>Line 1\nLine2</textarea>", ...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsTree All times are GMT
Page 1 of 1