FormMail Redirection


#1

I am having trouble using the redirect function of the Form Mail cgi.

If i set the value of the hidden form element “redirect” manually in the HTML eg. value=“http://mysite.com” then everything works fine.
However i need to modify that value via javascript.

i use an onclick event on a radio button to set the value to my desired URL.

onclick=“document.Register.redirect.value=‘http://www.mysite.com’;”

debugging proves that the variable gets set properly but somehow the CGI does not recognize the new value OR the default value once it has been changed. The result after form submission is the same as if no redirection was used and i get a formail report page.

Is there something i am doing wrong?

~John


#2

Works for me. I made a testcase at http://openvein.org/testcase/form.pl

One thing that comes to mind is if you are making the form elements dynamically. You have to make sure the elements are being tied to the form that is being submitted. This means the control elements must be children of the form element, and the form element should be a child of the body element. Some people forget that when creating dynamic forms and then wonder why the data is not being submitted. It’s easy enough to do this using the W3C DOM specification, however on some browsers the non-standard innerHTML property fails to do this. I don’t think this is the case in your situation because if it were you’d probably getting “document.Register.redirect has no properties” error messages.

If you are still having problems, please try to post a more complete example of your code.

:cool: Perl / MySQL / HTML CSS


#3

Here is my code in it’s entirety.
I have only one idea… perhaps my values are formatted incorrectly.
the button at the top of the page tests the form and proves that the value is being set… i believe it is the formmail cgi that is not handling the data correctly. You think it could be because of the & characters and such in the link?
If so perhaps the cgi is reading the url wrong or defaulting back to a regular report page because of it.

~John

Online Registration
Button
On-line Registration Form
Full Name:

(eg. Dr. John H. Smith Jr.)

Address:
City:
State:
Zip:
Phone:
Email:
Event:
Choose Your Event 10K Crossroads Race 1-Mile Walk of Hope
Sex:
Choose Male Female
T-shirt Size:
Choose Medium Large X-Large
(T-shirts will be given to the first 200 paid registrants.)
Age on 3/20/04:
yrs
I understand that a 10K road race requires a level of physical fitness and health and entails associated risks. I am participating in this race freely and, for myself, my heirs, executors and administrators, waive and release any and all rights and claims for damages I have or may have against CONTACT of Fayetteville and/or the organizers and sponsors of this run and their representatives, as well as any and all claims of danger and actions whatsoever in any manner as a result of my participation in this race, including (but not limited to) any injuries I might suffer. I acknowledge that I am aware of the inherent risks involved in running such a race. I grant permission to all the foregoing to use any photographs, motion pictures, recordings or any other record of this event for any legitimate purpose.
I certify that I am at least 18 years of age and have read and understand all of the above.

I am under 18 years of age. My parent or legal guardian signifies that he/she has read and understands all of the above.


#4

Must be the formmail script, as I plugged your code into http://openvein.org/testcase/form2.pl and the redirect value is being submitted.

Is the recipient field being set correctly? It doesn’t appear to be an e-mail address though perhaps you munged it for posting here.

Also, why is enctype set to “Default” ? Here is the HTML 4.01 specification:

[quote]enctype = content-type [CI]
This attribute specifies the content type used to submit the form to the server (when the value of method is “post”). The default value for this attribute is “application/x-www-form-urlencoded”. The value “multipart/form-data” should be used in combination with the INPUT element, type=“file”.[/quote]
Change enctype=“Default” to enctype=“application/x-www-form-urlencoded” (or leave it out altogether)

:cool: Perl / MySQL / HTML+CSS


#5

If you’re going to post a really big section of code like this, try to post a link to it rather than posting the code directly into the forum.

If you name the file 'blah.html.txt", I think it’ll show up as text.