Yes, it is not being called from the form and I am wondering why. If I add an alert() to the com_xxxxx/js/formvalidator.js file, it does appear. But I what I would like to do is to add it in my form, in the view that produces the form. Maybe I don't understand the role of the javascript section at the top of my file:
<?php Suivirm6Helper::headerDeclarations(); ?>
<h1 class='componentheading'><?php echo(JText::_("SUIVIRM6_LAYOUT_NOUVEAU_SUIVI"));?></h1>
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function(pressbutton)
{
document.formvalidator.submitform(document.adminForm, pressbutton, function(pressbutton){
alert('On est dans la fonction document.formvalidator.submitform de nouveausuivi');
return Joomla.submitform(pressbutton);
});
return false;
}
</script>
<form action="<?php echo(JRoute::_("index.php")); ?>" method="post" name="adminForm" id="adminForm" class='form-validate'>
<div>
<?php echo JDom::_('html.toolbar', array(
"bar" => $this->lists['toolbar']
));
?>
<?php echo $this->loadTemplate('fly'); ?>
<?php echo $this->loadTemplate('form'); ?>
</div>
<?php echo JDom::_('html.form.footer', array(
'dataObject' => $this->suivisitem,
'values' => array(
'option' => "com_suivirm6",
'view' => "suivisitem",
'layout' => "nouveausuivi"
)));
?>
</form>
If I remove the javascript part ...
<script language="javascript" type="text/javascript">
Joomla.submitbutton = function(pressbutton)
{
document.formvalidator.submitform(document.adminForm, pressbutton, function(pressbutton){
alert('On est dans la fonction document.formvalidator.submitform de nouveausuivi');
return Joomla.submitform(pressbutton);
});
return false;
}
</script>
... the behavior of the form is not modified.
- the alert I placed in formvalidator.js is called
- the message " is requested. Please retry. Erreur" is posted and the form is not processed
- the user is sent back to the form
Why is that? What is the use of that "javascript" section?
Thanks again,