Validate and Send... No send

Hi, I have this XML:

<?xml version="1.0" encoding="iso-8859-1"?>
<items>
<item type="settings" position="label-left" labelWidth="150" inputWidth="750" noteWidth="750"/>
<item type="fieldset" name="data" label="Usuario/Contraseña" inputWidth="auto">
<item type="input" name="username" label="Usuario" inputWidth="150" required="true" validate="NotEmpty"/>
<item type="password" name="password" label="Contraseña" inputWidth="150" required="true" validate="NotEmpty"/>
</item>
<item type="block">
<item type="button" value="Enviar" name="doFormValidate"/>
</item>
</items>

And this to the my PHP page:

<body onload="doOnLoad()">
    <div id="form_userpassword"></div>
	<script>
            var myFormUserpassword;
            function doOnLoad() {
		myFormUserpassword = new dhtmlXForm("form_userpassword");
                myFormUserpassword.loadStruct("myxml.xml");
                myFormUserpassword.attachEvent("onButtonClick", function(name) {
                    window[name]();
                });
            }
            function doFormValidate() {
                myFormUserpassword.validate();
            
                myFormUserpassword.attachEvent("onAfterValidate", function(status){
                    if (status == true) {
                        myFormUserpassword.send("form2.php")
                    }
                });
            }
	</script>
    
</body> 

The validation runs ok, but not send the form to the form2.php

Any idea?

Hi
Unfortunetly there is not enough of data to reproduce the issue.
Please, provide us completed demo on support@dhtmlx.com with link to this topic
docs.dhtmlx.com/doku.php?id=othe … leted_demo

Darya, all the data is here… except the js link files

<link rel="stylesheet" type="text/css" href="resources/js/dhtmlx/dhtmlxForm/skins/dhtmlxform_dhx_skyblue.css">
    <script type="text/javascript" src="resources/js/dhtmlx/dhtmlx/dhtmlxcommon.js"></script>
    <script type="text/javascript" src="resources/js/dhtmlx/dhtmlxForm/dhtmlxform.js"></script>

And what about i.e. form2.php file?

See your email, I have send my project

Thanks!

Hi

you have recursion:
form’s send also calls validate before send, validate calls event, event-handler calls send - new loop. to skip send’s validation you need to set 4th send’s param to true: myForm.send(url, mode, callback, skipValidation)

I changed index page, so you need to update it in your demo and it should work
index.zip (937 Bytes)

Hi Andrei

I have updated the file but the form don’t go to the form2.php

your demo with index.html attached above works fine localy

Ok! Thanks for your patience!