title: Use JavaScript to validate a field in Shiny App
body: <p>I would like to validate a the a form on using JavaScript.  I know I can 
  add an <code>onclick</code> method to an actionButton by providing an <code>onclick</code> argument like so:</p>
  
  <pre><code>textInput('timeField', "Time",'12:00')
  actionButton('okButton', 
          'OK',
           onclick="function(){ if(!(/^([01][0-9]|2[0-3]):([0-6][0-9])$/
                                   .test($('#timeField').val()))){
                                         alert('download time must be in 24 hour (HH:MM)
                                                fomrat.'); 
                                    return false; } }"))
  </code></pre>
  
  <p>However, the quote characters in the JavaScript function get translated to <code>&amp;quot</code> or <code>&amp;#39</code>, which cause a syntax error.  I've tried wrapping the string in <code>HTML()</code> but that doesn't seem to change this behavior.  </p>
  
  <p>Is there any way to include a raw string in the <code>onclick</code> argument and not have it transformed by Shiny?  (or maybe a better way to validate a form on the client side in a Shiny App?)</p>