Forums

PHP

This topic is locked

php & javascript = No reaction

Posted 15 May 2003 11:26:03
1
has voted
15 May 2003 11:26:03 Eva Steinlechner posted:
I´m working with a project in php with forms filled with data from a mysqldatabase. At the first page the user do login and his registred data is shown. MY PROBLEM: if the user is changing some data I want to verify the form if all fields are ok, the script wich I´m using is a copy from the login-page where it works properly. But NO - I cant get any reaction from the javascript, the changed info is updated without any checkings.

Is there any combinations wich are forbidden in the php-code when I´m using Javascript or why cant I reach the script??
My code for calling the script is :

The script is placed between the head-tags
.......code....
<?php
If ($cmdEnd)
{
require('connDb.inc.php');
require('update.inc.php');
}
?>
<form name="frmAllmIntr" method="post" action="<?php echo $PHP_SELF?>">
.........code.....
<td colspan="2" rowspan="2"><input type="submit" name="cmdEnd" id="cmdEnd" value="AVSLUTA" tabindex="36" onClick="return verify(this.form)"></td>
</form>
Somebody with any ideas????

Replies

Replied 20 May 2003 07:44:33
20 May 2003 07:44:33 Allan Kent replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>The script is placed between the head-tags <hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

by this do you mean the JavaScript verify() function ?

allan
Replied 20 May 2003 07:46:57
20 May 2003 07:46:57 Eva Steinlechner replied:
YES
Replied 20 May 2003 08:52:13
20 May 2003 08:52:13 Allan Kent replied:
what happens if you alter your form tag to read

<pre id=code><font face=courier size=2 id=code>
&lt;form name="frmAllmIntr" method="post" onSubmit="return verify(this.form)" action="&lt;?php echo $PHP_SELF?&gt;"&gt;
</font id=code></pre id=code>

and your submit button to be a straight submit

<pre id=code><font face=courier size=2 id=code>
&lt;input type="submit" name="cmdEnd" id="cmdEnd" value="AVSLUTA" tabindex="36"&gt;
</font id=code></pre id=code>

this is how i normally do form validation.

allan
Replied 20 May 2003 09:02:05
20 May 2003 09:02:05 Eva Steinlechner replied:
I'll try this at once. Is there no problems with a lot of submit-buttons in the same form when I use this syntax?? I have buttons with wich I let the user delete or update theit stored data too...of course I'll se it when I try.
Replied 20 May 2003 09:22:00
20 May 2003 09:22:00 Allan Kent replied:
I normally create a seperate form for each unique function in a page - a form to delete, a form to update the form contents, but I guess it's down to personal preference.

You might be interested in this dwmx extension:

www.macromedia.com/cfusion/exchange/index.cfm#loc=en_us&view=sn121&viewName=Dreamweaver%20Extension&extID=450886

which is a very cool form checking thing.

allan

Reply to this topic