Topic: Clear form from php after submission

I was looking for a way to reset the form after the form has submit it, and the following is how I've done it.

There may be better ways, but this is a quick way to do it.

<form name="frmContact_us" id="frmContact_us" onsubmit="xajax_contact_us(xajax.getFormValues(contact_us)); return false">
.....

...

Some form fields here

<input type="submit" name="btnContact" value="contact us" />
<input type="reset" name="btnResetContactForm" value="Clear Form" />
</form>

function contact_us($formvalues){

$objR = new xajaxResponse();

#do validations and other stuff you may need

if($send_result==true){
  $objR->assign("feedback","innerHTML","We have received your information and we will contact you if necessary");

 #Now we clear the form
  $objR->script("xajax.$('frmContact_us').btnResetContactForm.click();");
}
return $objR;
}

If there is a better way to do it, please do post it here.

Re: Clear form from php after submission

$objResponse->script('document.getElementById(\'formId\').reset()');