Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 10-21-2009, 10:40 AM   #1
Warrior Member
 
Join Date: Sep 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Javascript Forms

I'm struggling with a problem with makeing my old form work with Javascript. Here is the old form that works with our CGI script:

Code:
   <form method="POST" enctype="application/x-www-form-urlencoded">

.... a series of fields....


   <input type="submit" name="save_meeting_msg" value="  Update  ">
ok this works... however when i try to apply the same syntax to our fancy javascript template (which adds pretty colors to the button etc.) it stops working: here is the code:

Code:

<form id="ContactForm" method="POST" enctype="application/x-www-form-urlencoded">


.... a series of fields....


<a href="#" class="link2" name="save_meeting_msg" onclick="document.getElementById('ContactForm').submit()"><strong><strong>Send</strong></strong></a>
its not passing along the VALUE variable 'save_meeting_msg' to the CGI script so when the form is submitted it doesn't know what to do.

I've looked everywhere and can't seem to find how to use the submit() to pass along the 'name' value in Javascript.

Your help is greatly appreciated.
earthgrid is offline   Reply With Quote
Old 10-21-2009, 06:18 PM   #2
Banned
War Room Member
 
Join Date: May 2009
Posts: 33
Thanks: 5
Thanked 1 Time in 1 Post
Default Re: Javascript Forms

You can't send form data through an a tag.

If you want to send the 'save_meeting_msg' variable/name along with a value then you should create a hidden input field and do it that way.

Hope that makes sense.
Robert24 is offline   Reply With Quote
Old 10-22-2009, 12:43 PM   #3
Active Warrior
War Room Member
 
cmaclean's Avatar
 
Join Date: May 2009
Location: Vancouver, British Columbia, Canada
Posts: 95
Thanks: 7
Thanked 8 Times in 7 Posts
Social Networking View Member's FaceBook Profile  View Member's Twitter Profile 
Default Re: Javascript Forms

You're better off using a server side form script. I'd suggest using a PHP script like formtoemail. They have a pro version as well.

cmaclean is offline   Reply With Quote
Old 10-22-2009, 02:48 PM   #4
Senior Warrior Member
War Room Member
 
mywebwork's Avatar
 
Join Date: Sep 2008
Location: Honolulu, Hawaii, USA & Montreal Canada
Posts: 2,218
Blog Entries: 1
Thanks: 759
Thanked 724 Times in 505 Posts
Default Re: Javascript Forms

Robert is correct, the easiest way of doing this is with a hidden text box holding your 'save_meeting_msg' variable.

Maybe it's complicating things to much but now that you have a "fancy JavaScript form" have you considered submitting the form values via AJAX (i.e. using the XMLHTTP method)? You could pass as many variables as you want as a JSON or XML string. If you use JSON it's really easy to work with the data directly with JavaScript and PHP 5.

Just a thought, best of luck with your project.

Bill
mywebwork is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Tags
forms, javascript, submit

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 03:53 AM.