Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have you tried replacing the submit button with a regular button, doing the validation in the onClick handler, and then submitting the form from within the onClick handler?</p> <p>Edit: e.g. replace</p> <pre><code>&lt;input onkeypress="return handleEnter(this, event)" type="submit" value="Submit" onclick="BG.startChatWithIssueForm(this.form, true); return false;" /&gt; </code></pre> <p>with</p> <pre><code>&lt;input onkeypress="return handleEnter(this, event)" type="button" value="Submit" onclick="BG.handleSubmit(this.form, true);" /&gt; </code></pre> <p>Then maybe use a Javascript function like this (I'm not sure exactly what order you want these things to happen in):</p> <pre><code>BG.handleSubmit = function(formElement, fallBackToFullWindow) { if (!formValidator()) return; BG.startChatWithIssueForm(formElement, fallBackToFullWindow); formElement.submit(); return false; } </code></pre> <p>Edit: Your validation function should probably return false if it finds something invalid.</p> <pre><code>function formValidator(){ // Make quick references to our fields var issueid = document.getElementById('issueid'); var username = document.getElementById('username'); var userid = document.getElementById('userid'); var issuedesc = document.getElementById('issuedesc'); var valid = true; // Check each input in the order that it appears in the form if(!madeSelection(issueid, "Please choose an issue")) valid = false; if(!notEmpty(username, "Please enter your name")) valid = false; if(!isAlphanumeric(username, "Numbers and Letters Only for name")) valid = false; if(!notEmpty(userid, "Please enter your user ID")) valid = false; if(!isAlphanumeric(userid, "Numbers and Letters Only for user ID")) valid = false; if(!notEmpty(issuedesc, "Please type a description of your problem")) valid = false; return valid; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload