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 [2016/10/30 23:23]
peternlewis [Excluding Set and/or Saving of Form Fields]
action:Custom_HTML_Prompt [2017/09/05 01:49]
peternlewis [Downloads]
Line 35: Line 35:
 | data-kmwindowid | an ID that can be used with the [Execute a JavaScript in Custom Prompt](https://​wiki.keyboardmaestro.com/​action/​Execute_a_JavaScript_in_Custom_Prompt) action | | data-kmwindowid | an ID that can be used with the [Execute a JavaScript in Custom Prompt](https://​wiki.keyboardmaestro.com/​action/​Execute_a_JavaScript_in_Custom_Prompt) action |
  
-For example:\\+For example:
 ```html ```html
 <body data-kmwindow="​SCREEN(Main,​Left,​20%),​SCREEN(Main,​Top,​20%),​420,​560">​ <body data-kmwindow="​SCREEN(Main,​Left,​20%),​SCREEN(Main,​Top,​20%),​420,​560">​
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 104: Line 105:
 ===== Using JavaScript ===== ===== Using JavaScript =====
  
-You may use any JavaScript that you normally could in an HTML page.\\+You may use any JavaScript that you normally could in an HTML page. 
 Keyboard Maestro provides the following built-in JavaScript functions: Keyboard Maestro provides the following built-in JavaScript functions:
  
Line 127: Line 129:
 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).
  
-==== Debugging JavaScript in the Form ====+==== 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:
  
-Please see this forum post:\\ +    onclick="​window.KeyboardMaestro.Submit('​OK'​)"
-[How to Enable JavaScript Console for KM Custom HTML Prompt](https://​forum.keyboardmaestro.com/​t/​javascript-console-in-custom-html-prompt/​2589/​8)+
  
-(!) Be aware that the system will not allow Keyboard Maestro Engine to see keys typed in its own windows so the [[trigger:Typed String | Typed String triggers]] will not work within Keyboard Maestro Engine windows.+do something like:
  
----- +    onclick="if ( document.getElementById('​myform'​).checkValidity() ) { window.KeyboardMaestro.Submit('​OK'​) } else { document.getElementById('​myform'​).reportValidity() }"
-===== Downloads ==== +
-  - None+
  
-----+==== Debugging JavaScript in the Form ====
  
  
-===== See Also =====+Please see this forum post [How to Enable JavaScript Console for KM Custom HTML Prompt](https://​forum.keyboardmaestro.com/​t/​javascript-console-in-custom-html-prompt/​2589/​8). 
 + 
 +(!) Be aware that the system will not allow Keyboard Maestro Engine to see keys typed in its own windows so the [[trigger:​Typed String | Typed String triggers]] will not work within Keyboard Maestro Engine windows.
  
 ---- ----
 +
 +===== 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 ===
Line 161: Line 171:
 - [[https://​forum.keyboardmaestro.com/​t/​custom-html-result-button-value-when-prompt-is-closed/​3213/​2|Custom HTML Result Button value when prompt is closed]] - [[https://​forum.keyboardmaestro.com/​t/​custom-html-result-button-value-when-prompt-is-closed/​3213/​2|Custom HTML Result Button value when prompt is closed]]
 - [[https://​forum.keyboardmaestro.com/​t/​png-optimizer/​3282|PNG Optimizer]] - [[https://​forum.keyboardmaestro.com/​t/​png-optimizer/​3282|PNG Optimizer]]
-- [[https://www.google.fr/search?q=site:​forum.keyboardmaestro.com+Custom+HTML+Prompt+action|Keyboard Maestro Forum topics about Custom HTML Prompt action]]+- [[https://forum.keyboardmaestro.com/​search?​q=Custom%20HTML%20Prompt%20action|Keyboard Maestro Forum topics about Custom HTML Prompt action]]
  
 ==== External References ==== ==== External References ====
Line 173: Line 183:
  
  
-  * 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/​general|Keyboard Maestro Forum, ​General ​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
action/Custom_HTML_Prompt.txt · Last modified: 2021/12/11 10:14 by peternlewis