473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can't get form action to execute with onsubmit

Hello. I created a form using JS validation with the form tag as
follows:

<form name="form1" action="dynaform.php" method="post" onsubmit="return
pvg_sub();">

The js validation script sends alerts when fields are not entered
properly and it seems to work, except...when there are no errors,
instead executing the php action script, I get a popup dialog box in IE6
asking if I want to download or run the php script. Can anyone tell me
why the php script is not executing? Thanks.

Apr 15 '07 #1
8 6674
On 4ÔÂ15ÈÕ, ÏÂÎç2ʱ55·Ö, "M.L." <m...@privacy.netwrote:
Hello. I created a form using JS validation with the form tag as
follows:

<form name="form1" action="dynaform.php" method="post" onsubmit="return
pvg_sub();">

The js validation script sends alerts when fields are not entered
properly and it seems to work, except...when there are no errors,
instead executing the php action script, I get a popup dialog box in IE6
asking if I want to download or run the php script. Can anyone tell me
why the php script is not executing? Thanks.

your server can't execute php script , you must configure it with
php ?
http://www.php.net for more info .

Apr 15 '07 #2
On Apr 15, 11:55 am, "M.L." <m...@privacy.netwrote:
Hello. I created a form using JS validation with the form tag as
follows:

<form name="form1" action="dynaform.php" method="post" onsubmit="return
pvg_sub();">

The js validation script sends alerts when fields are not entered
properly and it seems to work, except...when there are no errors,
instead executing the php action script, I get a popup dialog box in IE6
asking if I want to download or run the php script. Can anyone tell me
why the php script is not executing? Thanks.
Did you check the content type field returned by your script?
--
Prince
http://dyumnin.com/webapps/howto/web...vascript.shtml
http://dyumnin.com/

Apr 15 '07 #3
>Hello. I created a form using JS validation with the form tag as
>follows:

<form name="form1" action="dynaform.php" method="post"
onsubmit="return pvg_sub();">

The js validation script sends alerts when fields are not entered
properly and it seems to work, except...when there are no errors,
instead executing the php action script, I get a popup dialog box in
IE6 asking if I want to download or run the php script. Can anyone
tell me why the php script is not executing? Thanks.


your server can't execute php script , you must configure it with
php ?
http://www.php.net for more info .
Thanks for your reply. I found the dynaform.php script on the Internet
and it worked just fine without the onsubmit javascriptng. Each script
works fine alone; but the dynaform.php script won't launch after the js
is processed.

Apr 15 '07 #4
<pr****@dyumnin.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com
On Apr 15, 11:55 am, "M.L." <m...@privacy.netwrote:
>Hello. I created a form using JS validation with the form tag as
follows:

<form name="form1" action="dynaform.php" method="post"
onsubmit="return pvg_sub();">

The js validation script sends alerts when fields are not entered
properly and it seems to work, except...when there are no errors,
instead executing the php action script, I get a popup dialog box in
IE6 asking if I want to download or run the php script. Can anyone
tell me why the php script is not executing? Thanks.

Did you check the content type field returned by your script?
I don't know PHP. The only header programming I found in the script was
one to send a thank_you.html page or an error.html page. I don't know if
any of the following code will help:

*****************************
// CHECK FOR REQUIRED FIELDS IF ACTIVATED
if($required_on == "yes") {
$sub = substr($incoming_fields[$i], 0, 2);
if($sub == "r_") {
if($incoming_values[$i] == "" OR !isset($incoming_values[$i]) OR
$incoming_values[$i] == " ") {
header("Location: $required_errorpage");
exit();
}}}
*****************************
// FORWARD TO THANK YOU PAGE
header("Location: $incoming_thanks");
*****************************
// MAKE SURE DYNAFORM IS NOT BEING LOADED FROM THE URL
if($_SERVER['REQUEST_METHOD'] == "GET") {
echo "
<html>
<head><title>Webligo PHP DynaForm is installed correctly.</title></head>
<body>
<font style='font-family: verdana, arial; font-size: 9pt;'>
<b>DynaForm is installed correctly.</b></font><br>
<font style='font-family: verdana, arial; font-size: 8pt;'>
DynaForm Easy PHP Form Mailer was created by <a
href='http://www.webligo.com'>Webligo Developments</a>.
</font>
</body></html>
";
exit();
}
*****************************

Apr 15 '07 #5
What values does pvg_sub() return ?
If you want the form to submit it should return true.

Tim
"M.L." <me@privacy.netwrote in message
news:W%*****************@newssvr23.news.prodigy.ne t...
Hello. I created a form using JS validation with the form tag as
follows:

<form name="form1" action="dynaform.php" method="post" onsubmit="return
pvg_sub();">

The js validation script sends alerts when fields are not entered
properly and it seems to work, except...when there are no errors,
instead executing the php action script, I get a popup dialog box in IE6
asking if I want to download or run the php script. Can anyone tell me
why the php script is not executing? Thanks.

Apr 15 '07 #6
>Hello. I created a form using JS validation with the form tag as
>follows:

<form name="form1" action="dynaform.php" method="post"
onsubmit="return pvg_sub();">

The js validation script sends alerts when fields are not entered
properly and it seems to work, except...when there are no errors,
instead executing the php action script, I get a popup dialog box in
IE6 asking if I want to download or run the php script. Can anyone
tell me why the php script is not executing? Thanks.
What values does pvg_sub() return ?
If you want the form to submit it should return true.

Tim
Thanks for responding. All the subs return true unless previously set to
false, I think. The external js form validation code is below. I got
this script off a website too:
***********************************************
<!--
var b = 0 ;
var i = 0 ;
var errmsg = "" ;
var punct = "" ;
var min = 0 ;
var max = 0 ;

function pvg_email(field) {

if (b && (field.value.length == 0)) return true ;
if (! emailCheck(field.value))
{
field.focus();
if (field.type == "text") field.select();
return false ;
}

return true ;
}

function pvg_filledin(field) {

if (b && (field.value.length == 0)) return true;

if (field.value.length < min) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false ;
}

if ((max 0) && (field.value.length max)) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false ;
}

return true ;
}

function pvg_number(field) {

if (b && (field.value.length == 0)) return true ; ;

if (i)
var valid = "0123456789"
else
var valid = ".,0123456789"

var pass = 1;
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") pass = 0;

}

if (!pass) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}

if (field.value < min) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}
if ((max 0) && (field.value max)) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}

return true ;
}
function pvg_numseq(field) {
if (b && (field.value.length == 0)) return true ;

var valid = punct + "0123456789"

var pass = 1;
var digits = 0
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") pass = 0;
if (valid.indexOf(temp) (punct.length-1) ) digits++ ;

}

if (!pass) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false ; ;
}

if (digits < min) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}

if ((max 0) && (digits max)) {
alert(errmsg);
field.focus();
if (field.type == "text") field.select();
return false;
}

return true ;
}

function emailCheck (emailStr) {

var checkTLD=1;
var
knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|c oop|info|pro|museum|ws)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);

if (matchArray==null) {
alert(errmsg);
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert(errmsg);
return false;
}
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert(errmsg);
return false;
}
}

if (user.match(userPat)==null) {
alert(errmsg);
return false;
}

var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert(errmsg);
return false;
}
}

if (checkTLD && domArr[domArr.length-1].length!=2 &&
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert(errmsg);
return false;
}

if (len<2) {
alert(errmsg);
return false;
}

return true;
}

function pvg_sub()
{
b=0;
errmsg="Invalid email address";
if (! pvg_email(document.form1.r_Email) ) return false ;
b=0;
errmsg="First name must be filled in.";
min=2;
max=60;
if (! pvg_filledin(document.form1.r_Firstname) ) return false ;
b=0;
errmsg="Last name must be filled in.";
min=2;
max=60;
if (! pvg_filledin(document.form1.r_Lastname) ) return false ;
}
// -->

Apr 15 '07 #7
Lee
M.L. said:
>
>>Hello. I created a form using JS validation with the form tag as
follows:

<form name="form1" action="dynaform.php" method="post"
onsubmit="return pvg_sub();">

The js validation script sends alerts when fields are not entered
properly and it seems to work, except...when there are no errors,
instead executing the php action script, I get a popup dialog box in
IE6 asking if I want to download or run the php script. Can anyone
tell me why the php script is not executing? Thanks.


your server can't execute php script , you must configure it with
php ?
http://www.php.net for more info .

Thanks for your reply. I found the dynaform.php script on the Internet
and it worked just fine without the onsubmit javascriptng. Each script
works fine alone; but the dynaform.php script won't launch after the js
is processed.
That doesn't really make sense. You won't see any indication of the PHP
file trying to execute unless the onsubmit() has worked correctly.
The PHP code will be loaded into a new page, so nothing in the Javascript
on the previous page can prevent it from loading.

Verify that the php page loads if you don't define any onsubmit handler
at all.
--

Apr 16 '07 #8
>>>Hello. I created a form using JS validation with the form tag as
>>>follows:

<form name="form1" action="dynaform.php" method="post"
onsubmit="return pvg_sub();">

The js validation script sends alerts when fields are not entered
properly and it seems to work, except...when there are no errors,
instead executing the php action script, I get a popup dialog box
in IE6 asking if I want to download or run the php script. Can
anyone tell me why the php script is not executing? Thanks.
your server can't execute php script , you must configure it with
php ?
http://www.php.net for more info .

Thanks for your reply. I found the dynaform.php script on the
Internet and it worked just fine without the onsubmit javascriptng.
Each script works fine alone; but the dynaform.php script won't
launch after the js is processed.

That doesn't really make sense. You won't see any indication of the
PHP file trying to execute unless the onsubmit() has worked correctly.
The PHP code will be loaded into a new page, so nothing in the
Javascript on the previous page can prevent it from loading.

Verify that the php page loads if you don't define any onsubmit
handler at all.
No, it doesn't make any sense. I loaded the file into a file compare app
and found that I was missing a closing </FORMtag in my HTML.
Everything works fine now. Thanks to all who replied.

Apr 16 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: jeff | last post by:
Hello, I have a form that submits it's values to a pop-up window. I've simplied the code: <form name="formname" action="action.php" target="windowName" method="post" onsubmit="window.open('',...
4
by: Sarah | last post by:
Hi all. I have a form, and several text and image links on it that should submit the form with different actions. I prepared a simple page with just the code that's not working. PROBLEM:...
4
by: Kai Grossjohann | last post by:
I have two frames. Frame "search" contains a search form specifying an onsubmit action like so: <form ... onsubmit="foo();"> ... </form> The other frame contains a <img ......
7
by: NetCoder | last post by:
Hi to all, I have made a script that uses both JavaScript and PHP. The script has a form and when it is submitted, a JavaScript confirmation box appears, asking the user to confirm their action....
13
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if...
10
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
2
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
4
by: Mark Miller | last post by:
I've been trying to execute a javascript function just before submit on a form that contains an <input type="file"> input field and it isn't working. The reason I want to do this is the end users...
8
by: dougawells | last post by:
I'm not figuring this probably simple thing out. I've got a form that when submitted takes an action to a Perl script..."...formsubmit.pl". I want to be able to validate some fields, so put an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.