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
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/09/05 01:49]
peternlewis [Downloads]
Line 80: Line 80:
 Note: Prior to 7.1 autofocus did not work for textarea types. Note: Prior to 7.1 autofocus did not work for textarea types.
  
-The *Keyboard Maestro Variable* “//**HTML Result Button**//​” ​is set to the parameter in the `Submit()` function. ​ For example:+The [[token:​HTMLResult|%HTMLResult%]] token (v8+) is set to the the parameter in the `Submit()` function, and can be used in actions later in this instance like any other text token.  ​The deprecated _HTML Result Button_ variable is also set to the parameter. 
 + 
 +For example:
  
 ```html ```html
Line 89: Line 91:
  
 Prior to version 7.1, the *Keyboard Maestro Variables* //**HTML Result Button**// was not changed when the window was closed by other than a Submit call - as of 7.1+ the variable is cleared when the window first appears. Prior to version 7.1, the *Keyboard Maestro Variables* //**HTML Result Button**// was not changed when the window was closed by other than a Submit call - as of 7.1+ the variable is cleared when the window first appears.
- 
  
 ==== Excluding Set and/or Saving of Form Fields ==== ==== Excluding Set and/or Saving of Form Fields ====
Line 127: Line 128:
  
 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 136: Line 147:
  
 ---- ----
-===== Downloads ==== 
-  - None 
- 
----- 
- 
  
 ===== See Also ===== ===== See Also =====
- 
----- 
  
 === Actions === === Actions ===
  
 +* [[action:​Alert|Alert]] action
 * [[action:​Prompt for User Input|Prompt for User Input]] * [[action:​Prompt for User Input|Prompt for User Input]]
 * [[:​Actions|See all Actions]] * [[:​Actions|See all Actions]]
  
-----+=== Tokens === 
 + 
 +* [[token:​AlertButton|%AlertButton%]] token 
 +* [[token:​PromptButton|%PromptButton%]] token 
 +* [[token:​HTMLResult|%HTMLResult%]] token 
 +* [[:​Tokens|All Tokens]]
  
 === Forum === === Forum ===
action/Custom_HTML_Prompt.txt · Last modified: 2021/12/11 10:14 by peternlewis