开发者

grails calendar reset

开发者 https://www.devze.com 2023-01-03 20:36 出处:网络
I installed calendar Ver开发者_运维百科sion 1.2.0-SNAPSHOT in grails and working good . But facing one Issue :

I installed calendar Ver开发者_运维百科sion 1.2.0-SNAPSHOT in grails and working good . But facing one Issue :

When click on cancel button i was doing form reset .but the calendar field is becoming clear and not reseting to default date .

<g:form url="${response}" id="program" name="program" method="post">
<calendar:datePicker name="startDate" id="startDate" defaultValue="${program.startDate}" dateFormat="%Y-%m-%d"/>
<input type="button" id="cancel" name="cancel" value="Cancel" onclick = 'reset_form(this)' />
</g:form>

function reset_form(this_)
{
    document.getElementById('program').reset();
}

any one have idea please ?

thanks.


Two ways to solve this issue as far as I can see. Either correct the typo inside your JavaScript and refer to the correct id of your form (program not new_program) or use the standard reset button for forms <input type="reset" .../> instead of your javascript solution.

0

精彩评论

暂无评论...
验证码 换一张
取 消