tengo esta forma que la creo dinamicamente con la libreria xajax, pero dicha forma estoy intentando validarla con el script de validation.js, hasta ahi esta perfecto me hace las validaciones correctas.
Código PHP:
function showGrid(){
//<form id="form1" name="form1" method="post" action="providerdisclaimer.php">
$html ='<form id="test" >
<fieldset>
<legend>Form</legend>
<div class="form-row">
<div class="field-label"><label for="field1">Name</label>:</div>
<div class="field-widget"><input name="field1" id="field1" class="required" title="Enter your name" /></div>
</div>
<div class="form-row">
<div class="field-label"><label for="field111">Date</label>:</div>
<div class="field-widget"><input name="field111" id="field111" class="required validate-date" title="Enter your DOB" /></div>
</div>
<div class="form-row">
<div class="field-label"><label for="field8">Password</label>:</div>
<div class="field-widget"><input type="password" name="field8" id="field8" class="required validate-password" title="Enter a password greater than 6 characters" /></div>
</div>
<div class="form-row">
<div class="field-label"><label for="field9">Confirm Password</label>:</div>
<div class="field-widget"><input type="password" name="field9" id="field9" class="required validate-password-confirm" title="Enter the same password for confirmation" /></div>
</div>
<div class="form-row">
<div class="field-label"><label for="field3">Employee Number</label>:</div>
<div class="field-label">
<input name="field3" id="field3" class="required validate-alphanum" title="Enter your employee number, please use only alphanumeric characters" />
</div>
</div>
<div class="form-row">
<div class="field-label"><label for="field7">Department</label>:</div>
<div class="field-widget">
<select id="field7" name="field7" class="validate-selection" title="Choose your department">
<option>Select one...</option>
<option>Accounts</option>
<option>Human Resources</option>
<option>Information Technology</option>
<option>Animal Management</option>
<option>Ultimate Frisby</option>
</select>
</div>
</div>
<div class="form-row">
<div class="field-label"><label for="field4">Age</label>:</div>
<div class="field-label"><input name="field4" id="field4" class="validate-number" title="Optional: Enter your age" /> (optional)</div>
</div>
<div class="form-row">
<div class="field-label"><label for="field6">Sex</label>:</div>
<div class="field-label">
<input type="radio" name="field6" id="field6-male" value="Male" />Male<br />
<input type="radio" name="field6" id="field6-female" value="Female" class="validate-one-required" />Female
</div>
</div>
<div class="form-row">
<div class="field-label"><label for="field5">Donation</label>:</div>
<div class="field-label">
<div id="advice-validate-currency-dollar-field5" class="custom-advice" style="display:none">That $ amount does not compute!</div>
<input name="field5" id="field5" class="validate-currency-dollar" title="Enter a dollar amount for donation" /> (optional)
</div>
</div>
</fieldset>
<button id="submitButton" onClick=\'xajax_save(xajax.getFormValues("f"));\'>Create account</button>
<input type="button" value="Reset" onclick="valid.reset(); return false" />
</form>';
$objResponse = new xajaxResponse();
$objResponse->addClear("grid", "innerHTML");
$objResponse->addAssign("grid", "innerHTML", $html);
[COLOR="Red"]$objResponse -> addIncludeScript("validacion/valida.js");[/COLOR]
return $objResponse->getXML();
}
para que la validacion tenga efecto necesito en la forma (test) incluir javascript lo cual no se si se pueda, pero lo soluciones con esta linea addIncludeScript("validacion/valida.js"), hasta ahi todo va bien el contenido del script es
valida.js;
Código:
[/LEFT]function formCallback(result, form) { window.status = "valiation callback for form '" + form.id + "': result = " + result; // window.returnValue(result); } var valid = new Validation('test', {immediate : true, onFormValidate : formCallback}); Validation.addAllThese([ ['validate-password', 'Your password must be more than 6 characters and not be \'password\' or the same as your name', { minLength : 7, notOneOf : ['password','PASSWORD','1234567','0123456'], notEqualToField : 'field1' }], ['validate-password-confirm', 'Your confirmation password does not match your first password, please try again.', { equalToField : 'field8' }] ]);
aqui es donde surge mi problema despues de que le usuario llene los datos necesito que al apretar el boton de
Código:
<button id="submitButton" onClick=\'xajax_save(xajax.getFormValues("f"));\'>Create account</button>
mande llamar la funcion save este es el contenido de dicha funcion
save
Código:
{ $objResponse = new xajaxResponse(); $message = ????; if(!$message){ $html = add(); //echo $html; $objResponse->addAssign("msgZone", "style.visibility", "visible"); $objResponse->addAssign("msgZone", "innerHTML", $html); }else{ $objResponse->addAlert($message); } return $objResponse->getXML(); }
y necesito guardar en la variable $message el resultado que me envie el script valida.js
las cuestiones son
1.- es posible hacer esto??
2.- como obtengo el valor que me envia el valida.js en la variable $message
gracias po su tiempo y por cualquier comnetario