[pmwiki-users] Validating forms in pmwiki
Hans
design5 at softflow.co.uk
Fri Jul 3 09:13:27 CDT 2009
Friday, July 3, 2009, 3:04:13 PM, Hans wrote:
> I think one may need some javascript to prevent
> the 'Enter' key pressed as being interpreted as a form submit.
> A solution would be PmWiki specific, not Fox, as some javascript
> event hook needs to be added to text and textarea input fields.
i think this should work:
add to config.php:
#prevent hitting 'Enter' from submitting a form
HTMLHeaderFmt['noenter'] =
"<script language='JavaScript'>
function disableEnterKey(e)
{
var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
return (key != 13);
}
/script> ";
InputTags['textarea'][':html'] =
"<textarea \$InputFormArgs onKeyPress='return disableEnterKey(event)'>\$InputFormContent</textarea>";
InputTags['text'][':html'] =
"<input type='text' \$InputFormArgs onKeyPress='return disableEnterKey(event)' />";
~Hans
More information about the pmwiki-users
mailing list