User Tools

Site Tools


action:Custom_HTML_Prompt

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
action:Custom_HTML_Prompt [2017/03/29 04:44]
JMichaelTX Add keywords
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 ====
action/Custom_HTML_Prompt.txt · Last modified: 2021/12/11 10:14 by peternlewis