function my_fav_quote_show_optin_form() {
if (!empty($_POST['my_fav_quote_email'])) {
my_fav_quote_opt_in();
}
$out2 = '';
$out = '<form action="" method="post" id="requestQuote">';
$out .= '<table style="padding="0px" width="40px">';
$out .= '<tr><td style="vertical-align: middle;">Message:<br></td><td><textarea placeholder="" name="my_fav_quote_message" id="my_fav_quote_message"></textarea></td></tr>';
$out .= '';
$out .='<tr><td colspan="2">';
if ( function_exists( 'my_fav_quote_display' ) ){
$out .= my_fav_quote_display();
}
if ( function_exists( 'my_fav_quote_display3' ) ){
$out .= my_fav_quote_display3();
}
$out .='</td></tr>';
$out .= '<tr><td colspan=2 align=center><input type="submit" value="Request Quote" onclick="return chk_validation()" style="background-color:#000;color:#FFF;padding:5px;margin-top:10px;border:none;cursor:pointer;"/> <input type="button" onclick="formReset()" value="Reset form" /></td></tr>';
$out .='</table></form>';
echo $out;
?>
<script language="javascript" type="text/javascript">
function formReset()
{
document.getElementById("requestQuote").reset();
}
//<![CDATA[
function validate_email(field,alerttxt)
{
apos=field.indexOf("@");
// alert(apos);
dotpos=field.lastIndexOf(".");
//alert(dotpos);
if (apos<1||dotpos-apos<2)
{ return false;}
else {return true;}
}
function chk_validation()
{
if(document.getElementById("my_fav_quote_name") && document.getElementById("my_fav_quote_name").value == '')
{
alert("Please Enter Name");
document.getElementById("my_fav_quote_name").focus();
return false;
}
if(document.getElementById("my_fav_quote_email").value == '')
{
alert("Please Enter Email");
document.getElementById("my_fav_quote_email").focus();
return false;
}
else
{
//alert(validate_email(document.getElementById("my_fav_quote_email").value,"Not a valid e-mail address!");
if (validate_email(document.getElementById("my_fav_quote_email").value,"Please enter valid e-mail address!")==false) {
alert("Please enter valid e-mail address!");
document.getElementById("my_fav_quote_email").focus();
return false;
}
}
if(document.getElementById("security_code").value == '')
{
alert("Please Enter Security Code");
document.getElementById("security_code").focus();
return false;
}
if(document.getElementById("quotes").value == '')
{
alert("Please add atleast one request quote");
document.getElementById("quotes").focus();
return false;
}
//return true;
}
//]]>
</script>
<?php
}
это форма одного из плагинов wordpress, написанных на php. Мне нужно добавить кнопку сброса, для которой я пытался использовать
function formReset()
{
document.getElementById("requestQuote").reset();
}
, но это не работало
Использование плагина Wordpress ссылка
Я хочу сбросить форму, когда пользователь нажимает кнопку сброса, все отображаемые данные должны быть удалены из всех полей и из (двух функций)my_fav_quote_display3 & my_fav_quote_display &), которого на самом деле не было.
В чем причина, по которой я могу это сделать?