mtek@mtekusa.com wrote:
> Another issue. I'm triny to submit a form and have it run some
> Javascript validation code before continuing. The button is an HTML
> button.
It is not. It is a pseudo-link.
> This is my code:
>
> a href="javascript:document.Add_Data.action =
> 'savedata.php';document.Add_Data.submit();">SAVE Data</a>
Yuck. Consider this instead:
<script type="text/javascript">
function submitMe(f)
{
f.action = "saveData.php";
f.submit();
--
document.write('<a href=""'
+ ' onclick="submitMe(document.forms[\'Add_Data\']);"'
+ '>SAVE Data<\/a>');
</script>
It would be better to use the same server-side script for all actions, a
real HTML button --
<input type="submit" name="save" value="SAVE Data">
-- for this one, and then use "isset ($_REQUEST['save'])" (or its quivalent)
server-side. This way it also worked if client-side script support was
unavailable.
> The name of the form is Add_Data.
>
> Any idea why that would not work??
a) Unsupported proprietary `javascript
:' URI scheme
b) A form control named "submit" overriding the form's submit() method
RTFFAQ:
http://jibbering.com/faq/
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>