This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
action:Custom_HTML_Prompt [2017/03/14 04:47] peternlewis |
action:Custom_HTML_Prompt [2017/05/10 21:46] peternlewis Form Validation |
||
---|---|---|---|
Line 127: | Line 127: | ||
Prior to version 7.1, using SetVariable to set a value to something other than a string can [corrupt the variable](https://forum.keyboardmaestro.com/t/corrupted-variables-after-custom-html-setvariable-update-i-fixed-it-please-read/2881). | Prior to version 7.1, using SetVariable to set a value to something other than a string can [corrupt the variable](https://forum.keyboardmaestro.com/t/corrupted-variables-after-custom-html-setvariable-update-i-fixed-it-please-read/2881). | ||
+ | |||
+ | ==== Form Validation ==== | ||
+ | |||
+ | You can use HTML5’s form validation to automatically validate the fields. Specify their input types (eg "email" or "url" instead of "text"), as well as other properties like minimum/maximum numbers and so on, and then instead of simply: | ||
+ | |||
+ | onclick="window.KeyboardMaestro.Submit('OK')" | ||
+ | |||
+ | do something like: | ||
+ | |||
+ | onclick="if ( document.getElementById('myform').checkValidity() ) { window.KeyboardMaestro.Submit('OK') } else { document.getElementById('myform').reportValidity() }" | ||
==== Debugging JavaScript in the Form ==== | ==== Debugging JavaScript in the Form ==== | ||
Line 174: | Line 184: | ||
* If your favorite Web/HTML editor is not listed here, and you would like to include it, post a request in the [[https://forum.keyboardmaestro.com/c/wiki|Keyboard Maestro Forum, Wiki section]]. | * If your favorite Web/HTML editor is not listed here, and you would like to include it, post a request in the [[https://forum.keyboardmaestro.com/c/wiki|Keyboard Maestro Forum, Wiki section]]. | ||
+ | |||
+ | --- | ||
+ | |||
+ | **Keywords:* Custom HTML Prompt, User Prompt, HTML, Dialog |