[Cartoweb-users] Checking form

Pierre GIRAUD pierre.giraud at camptocamp.com
Wed Jun 7 10:10:49 EDT 2006


Jacolin Yves wrote:

>Hi,
>I would like to check my form after submit it. Is there a way to run a 
>javascript code to check my form with onsubmit="". The javascript code will 
>be in the htdocs/js/layersManager.js file of my plugin.
>
>Thanks,
>
>Y.
>  
>
In the dhtmlInit.js you have a doSubmit() method that is called in 
almost all cases when the form is submited.
You can override this file in your project. And modify the content of 
the method.

You can also add this snipet of code at the end of the head element of 
your plugin main template (cartoclient.tpl) :

<script>
{literal}
/**
 * Submits the form
 * Overrides the standard method set in dhtmlInit.js
 */
doSubmit = function() {
  theFormCheckMethod();
  xShow(xGetElementById('loadbarDiv'));
  myform = document.forms['carto_form'];
  myform.submit();
};
{/literal}
</script>

This is like a hack but it is the quickest way to get this working, 
IMHO. Althought, I didn't really test it.

Regards

Pierre


More information about the Cartoweb-users mailing list