Reputation: 3420
We use YUI 2.9.0, and on a form we have a problem : if we press enter on an input type="text", the form is submitted the "normal way", and not via the async mode of YUI Dialog (the "normal way" is the one used in pure HTML web, without JS and web 2.0 asynchronous comm).
On this page I can see the bug was handled in version 2.3.1, but I still have one issue http://tech.groups.yahoo.com/group/ydn-javascript/message/30139 In fact in depend of the content of the form : with a text and a select field I have the issue, if I had the datepicker it's run ok.
Is there any way, appart of key listerner wich stop enter key press?
Upvotes: 2
Views: 678
Reputation: 39658
you can shutdown form submissions on your dialog by putting this in the form tag:
<form onsubmit="return(false);" id="myId" name="myName" action="" method="">
you'll then have to put an event listener to your button or do the XHR submission yourself .
althought if you use this declaration for your dialog with isDefault set to true in handleSubmit you wouldnt probably have the form submitted on enter keypress .
YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1",
{ width : "300px",
fixedcenter : true,
visible : false,
constraintoviewport : true,
buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
{ text:"Cancel", handler:handleCancel } ]
} );
Upvotes: 3