Skip to main content
Inspiring
January 20, 2011
Answered

validateat="onblur"

  • January 20, 2011
  • 2 replies
  • 1753 views

Hi guys.

Any reason why my code wont run this onblur of a textbox ? is there anywork around ?

<cfinput id="surname"

     name="surname"

     type="text"

     required="Yes"

     validate="regex"

     validateat="onblur"

     pattern="^[A-Z -']+$"

     message="Please enter a valid Surname."

     onChange="javascript:this.value=this.value.toUpperCase();"/>

    This topic has been closed for replies.
    Correct answer Adam Cameron.

    I have a funny feeling that if you use onvalidate="onblur", it wont allow you to use validate="regex".

    My findings match yours: I cannot get a regex - even the most simple one - to work onblur.

    Can I suggest you raise a bug with Adobe:

    http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#

    --

    Adam

    2 replies

    Inspiring
    January 21, 2011

    I'm not sure why its not working.

    Can you use UCASE Cf function to change to upper case letters.

    In one of the notes its given as below.

    Note: To force a pattern to be all-uppercase or all-lowercase, use the ColdFusion UCase or LCase functions in the action page.

    _G_1Author
    Inspiring
    January 21, 2011

    Thanks for all the replys guys, its all helpful.  I have tried using ucase to no avail and I still do not get an error message "onblur" of the textbox.

    I have looked at the source code in internet explorer and can see that this is how the browser is interpreting the textbox in html

    <input name="surname" type="text" value="GEORGIOU" maxlength="60"  class="txt"  id="surname"  title="Applicant surname"  onblur="if( !_CF_hasValue(this, 'TEXT', false) && !_CF_checkregex(this.value,/^[A-Z -']+$/, true) ){ _CF_onErrorAlert(new Array('Please enter a valid Surname.')); }" />

    I have a funny feeling that if you use onvalidate="onblur", it wont allow you to use validate="regex".

    Adam Cameron.Correct answer
    Inspiring
    January 21, 2011

    I have a funny feeling that if you use onvalidate="onblur", it wont allow you to use validate="regex".

    My findings match yours: I cannot get a regex - even the most simple one - to work onblur.

    Can I suggest you raise a bug with Adobe:

    http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#

    --

    Adam

    Inspiring
    January 20, 2011

    Regular expressions are not my strength so I don't know the answer.  What I do know, however, is that validating onBlur allows the user to submit the form without changing the "bad" value.