Textfield Validation Breaks

Hello All,
I was designing a page where I wanted the user to be forced
to use the Dynarch Calendar (Great with Spry!!!) and not enter a
date in the wrong format, because Dynarch breaks spry if you try to
enforce a pattern.
So to do this, I set the the "readonly" attribute on the
textfiels so someone cannot enter a date manually and are forced to
use the popup. I have this many times in my site, but I'm starting
to convert all my ADDT forms to SPRY (which is VERY easy, good job
SPRY Team!).
It took me about a day to realize that the readonly was
breaking the validation. Just want to let others know before they
spend a day looking at this for nothing.
Cheers!
Kevin

You can add the following to your onclick function and you
should be all set.
function postForm(YourForm)
var val = Spry.Widget.Form.validate(YourForm);
if (val)
… Your post function

Similar Messages

  • Spry textfield validation

    Hi, how can I modify this code for the spry textfield validation.js file? My text field is set to yyyy-mm-dd.  When I enter a date and hit the submit button all works well but, how can I modify this portion of the .js file so the date yyyy-mm-dd is not less than today's date?
    ===================
    'date': {
    validation: function(value, options) {
    var formatRegExp = /^([mdy]+)[\.\-\/\\\s]+([mdy]+)[\.\-\/\\\s]+([mdy]+)$/i;
    var valueRegExp = this.dateValidationPattern;
    var formatGroups = options.format.match(formatRegExp);
    var valueGroups = value.match(valueRegExp);
    if (formatGroups !== null && valueGroups !== null) {
    var dayIndex = -1;
    var monthIndex = -1;
    var yearIndex = -1;
    for (var i=1; i<formatGroups.length; i++) {
    switch (formatGroups[i].toLowerCase()) {
    case "dd":
    dayIndex = i;
    break;
    case "mm":
    monthIndex = i;
    break;
    case "yy":
    case "yyyy":
    yearIndex = i;
    break;
    if (dayIndex != -1 && monthIndex != -1 && yearIndex != -1) {
    var maxDay = -1;
    var theDay = parseInt(valueGroups[dayIndex], 10);
    var theMonth = parseInt(valueGroups[monthIndex], 10);
    var theYear = parseInt(valueGroups[yearIndex], 10);
    // Check month value to be between 1..12
    if (theMonth < 1 || theMonth > 12) {
    return false;
    // Calculate the maxDay according to the current month
    switch (theMonth) {
    case 1: // January
    case 3: // March
    case 5: // May
    case 7: // July
    case 8: // August
    case 10: // October
    case 12: // December
    maxDay = 31;
    break;
    case 4: // April
    case 6: // June
    case 9: // September
    case 11: // November
    maxDay = 30;
    break;
    case 2: // February
    if ((parseInt(theYear/4, 10) * 4 == theYear) && (theYear % 100 != 0 || theYear % 400 == 0)) {
    maxDay = 29;
    } else {
    maxDay = 28;
    break;
    // Check day value to be between 1..maxDay
    if (theDay < 1 || theDay > maxDay) {
    return false;
    // If successfull we'll return the date object
    return (new Date(theYear, theMonth - 1, theDay));   //JavaScript requires a month between 0 and 11
    } else {
    return false;
    ======================
    Thanks Winrol

    V1 Fusion wrote:
    > Yes you can use regular expessions:
    >
    > function validatePhone(value){
    > return
    >
    /^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?
    >
    \d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3})
    > )?$/.test(value)
    > }
    >
    > var custom = new Spry.ValidationTextField(id, "custom",
    {validation:
    > validatePhone, validateOn:["blur", "change"]})
    >
    > regexp from
    http://regexlib.com/
    Excellent, thank you, that will get me in the right
    direction. Its not
    100%, but I think I can tinker with an expression to get what
    I want.
    The number is couldn't handle is +44 (0)113 255 7666 but its
    not an
    approved format anyway, but lots of companies still do it
    this way, so I
    want to ensure I get it right.
    Thanks again!
    Dooza
    Posting Guidelines
    http://www.adobe.com/support/forums/guidelines.html
    How To Ask Smart Questions
    http://www.catb.org/esr/faqs/smart-questions.html

  • UI Datepicker and Spry textfield Validation

    Hi, I am having a problem with using the UI Date picker and Spry textfield Validation together. I have created a sample form: 2 input boxe, the test box has the datepicker and spry validation and test2 has the date picker only,one submit button and some php code that echos the boxes values on submit.
    My date picker is date formated as 'yy-mm-dd' for four digit year.  My spry validation is formated 'yyyy-mm-dd' with validate on submit.
    Now when I click on the test input box the datepicker comes up normally and i select a date. I then select the date on test2. Once I click the submit button the test field with spry validation come back saying a value is required and nothing else happens.
    I was playing around and trying other things to get it to work and I noticed that when I select the test inputbox and the calander pops up if I enter some numbers into the text box then select a date from the datepicker then enter a date in the test2 inputbox and hit submit it works.
    So it appears to me that the validation is not reading anything in the test field when I just select a date.  Why is that?  When I select a date it shows a date in the inputbox.  It makes it hard to use the datepicker on a form.
    Any help would be a preciated.  Code is below.
    Thanks Winrol
    <?php echo "Test box 1 value = ". $_POST['test']. "<br/>" ?>
    <?php echo "Test box 2 value = ". $_POST['test2'] ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    <script src="jquery-ui-1.7.2/js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="jquery-ui-1.7.2/js/jquery-ui-1.7.2.min.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="jquery-ui-1.7.2/css/base/ui.core.css" rel="stylesheet" type="text/css" />
    <link href="jquery-ui-1.7.2/css/base/ui.datepicker.css" rel="stylesheet" type="text/css" />
    <link href="jquery-ui-1.7.2/css/base/ui.theme.css" rel="stylesheet" type="text/css" />
    <link href="jquery-ui-1.7.2/css/base/ui.datepicker.images.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    /* BeginOAWidget_Instance_2137022: #datepicker */
    #datepicker .ui-widget {
    font-family: inherit;
    #datepicker .ui-datepicker {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    #datepicker .ui-datepicker-title {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    font-size: 1.1em;
    color: #000;
    font-weight: normal;
    line-height: 1.8em;
    #datepicker .ui-state-default, .ui-widget-content .ui-state-default {
    border-color: #e6e6e6;
    background-color: #e6e6e6;
    color: #555555;
    #datepicker .ui-state-default, .ui-state-default a {
    color: #555555;
    #datepicker .ui-state-highlight, .ui-widget-content .ui-state-highlight {
    border-color:#FCEFA1;
    background-color:#FCEFA1;
    color:#363636;
    #datepicker .ui-state-active, .ui-widget-content .ui-state-active {
    border-color: #FFFFFF;
    background-color: #FFFFFF;
    color: #212121;
    #datepicker .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus
    border-color: #5F5F5F;
    background-color: #5F5F5F;
    color: #212121;
    #datepicker .ui-widget-header
    border-color: #5F5F5F;
    background-color: #808080;
    border-width: 1px;
    /* Text attributes for the Days of Week Text */
    #datepicker .ui-datepicker table th
    font-size: .8em;
    color: #000;
    font-weight: bold;
    /* EndOAWidget_Instance_2137022 */
    </style>
    <script type="text/xml">
    <!--
    <oa:widgets>
      <oa:widget wid="2137022" binding="#datepicker" />
    </oa:widgets>
    -->
    </script>
      <script type="text/javascript">
    // BeginOAWidget_Instance_2137022: #datepicker
    $(function() {
    $('input').filter('.datepicker').datepicker({dateFormat: 'yy-mm-dd'});
    // EndOAWidget_Instance_2137022
      </script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    body {
    background-color: #FFC;
    </style>
    </head>
    <body>
    <form id="form1" name="form1" method="post" action="">
      <p>
        <label for="test">test</label>
        <span id="sprytextfield1">
        <input name="test" type="text" class="datepicker" id="test"/>
        <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></p>
      <p>
        <label for="test2">test2</label>
        <input name="test2" type="text" id="test2"  class="datepicker" />
      </p>
      <p onclick="<?php echo $_POST['test'] ?>">
        <input type="submit" name="submit" id="submit" value="Submit" />
      </p>
    </form>
    <script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "date", {format:"yyyy-mm-dd", hint:"yyyy-mm-dd"});
    </script>
    </body>
    </html>

    This does work
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet">
    <link href="jquery-ui-1.7.2/css/base/ui.core.css" rel="stylesheet">
    <link href="jquery-ui-1.7.2/css/base/ui.datepicker.css" rel="stylesheet">
    <link href="jquery-ui-1.7.2/css/base/ui.theme.css" rel="stylesheet">
    <link href="jquery-ui-1.7.2/css/base/ui.datepicker.images.css" rel="stylesheet">
    </head>
    <body>
    <form action="" method="post">
    <span id="sprytextfield1">
    <label for="mydate">Date:</label>
    <input id="datepicker" name="mydate" type="text">
    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
    <div id="datepicker" class="ui-glass-gradient ui-80TopTo0Bottom-gradient-header"></div>
    <input name="mysubmit" type="submit">
    </form>
    <script src="SpryAssets/SpryValidationTextField.js"></script>
    <script src="jquery-ui-1.7.2/js/jquery-1.3.2.min.js"></script>
    <script src="jquery-ui-1.7.2/js/jquery-ui-1.7.2.min.js"></script>
    <script>
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "date", {format:"mm/dd/yyyy", validateOn:["change"], useCharacterMasking:true});
    $(function() {
        $('#datepicker').datepicker({ showOtherMonths: false });
    </script>
    </body>
    </html>
    Gramps

  • Error in TextField Validation Widget reset() method

    There appears to be an error in the Textfield Validation
    Widget's reset() method. When I set the widget to "real" or
    "custom" validation, the reset() method is throwing an error when
    it reaches the line "this.oldValue = this.input.defaultValue;"
    I seached the code and it appears that
    "this.input.defaultValue" is not set anywhere else. Is there a
    missing option, or is this line incorrect and copied over from
    another widget that uses "defaultValue"?

    It looks as though you're trying to use main-content as a CSS selector. If it's a class, it should begin with a dot (period) like this:
    .main-content
    If it's an ID selector, it should begin with a hash:
    #main-content

  • TextField Validation in swings

    Hello friends,
    i got a problem. i am doing textfield validation using KeyListener.
    i can able to detect the keys except Tab key.
    When i am pression TAB key the KeyListener is not catching the event.
    Actually validation should be in such a way that,
    in account number field if i press anyotherkeys otherthan numeric ,del,backspace keys it should not allow to enter.
    also it has to give error if user tries to move from that field without entering anydata by pressing TAB or Mouse.
    Here exactly getting problem with focus.
    Please give your advise
    thanks in advance
    regards
    shashi

    TextField Validation in swingsOk, you know its a Swing question, so it should be posting in the Swing forum.
    if i press anyotherkeys otherthan numeric ,del,backspace keys it should not allow to enter.You should be using a JFormattedTextField
    it has to give error if user tries to move from that field without entering anydata You could try an InputVerifier.

  • Multiple TextField Validation

    I want to do this:
    I have 3 textfields, when I click the submit button I want
    the validation to check whether there's data in any of the
    textfields (at least in one) if so, then all three textfields are
    Valid, if non of the textfield have data then all 3 textfields are
    invalid.
    Is this posible in Spry Framework 1.6.1; if so how is this
    done?
    I tried a custom validating function with option isRequired:
    false on and off without luck.

    Ok.Well I cannot provide link to the full page as the site is
    not up and running yet. However, here's the full html code;
    ofcourse you need to update the link to the spry code. I am using
    spry 1.6.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Untitled Document</title>
    <script src="../SpryAssets/SpryValidationTextField.js"
    type="text/javascript"></script>
    <link href="../SpryAssets/SpryValidationTextField.css"
    rel="stylesheet" type="text/css" />
    </head>
    <body>
    <form id="brochurereq" name="brochurereq" method="post"
    action="test.html">
    <input type="submit" value="Send" name="Send" />
    <span id="text1">
    <input type="text" name="firstname" id="firstname" />
    <span class="textfieldRequiredMsg">The value is
    required.</span>
    </span>
    <span id="text2">
    <input type="text" name="lastname" id="lastname" />
    <span class="textfieldRequiredMsg">The value is
    required.</span>
    </span>
    </form>
    <script type="text/javascript">
    <!--
    var sprytext1 = new Spry.Widget.ValidationTextField("text1",
    "none");
    var sprytext2 = new Spry.Widget.ValidationTextField("text2",
    "none");
    //-->
    </script>
    <body>
    </body>
    </html>

  • Function to call spry textfield validation

    Hi every body.
    I've a question for you.
    I'm using a filed spry text field validation. It works perfectly when y press submit, but I need to do this:
    I put some text in a textfield using PHP, the validation is only maked when I click the text field, or when  the user press a key, but how to make a function to do the validation after I put data on textfield.

    Click the on Blur as per
    Gramps

  • Urgent Pls... Textfield validation

    Hi All,
    In a textfield its should accept two conditions i.e.,
    1) It should accept 10 digits or
    2) In a field it should accept two chars and 5 digits. or than that its should pop up an alert.
    I have tried setting patterns and worte the script in exit event:
    if(this.rawValue == this.formattedValue)
    xfa.host.setFocus(this.name);
    But the setFocus is going again and again.
    Patterns: text{AA99999}|text{9999999999}  
    Please help.
    Thanks in advance
    Regards,
    Apurva

    Hi Apurva,
    You need regular expression for this. Remove all the validations of the text field first i.e display,edit,validation,data.
    In the exit event of the field put the following script.
    var vPattern = /^([a-zA-Z]{2}[0-9]{5})$|^([0-9]{10})$/;
    var result = vPattern.test(this.rawValue);
    if (result == false)
        xfa.host.setFocus(this.name);
    Thanks,
    Bibhu.

  • Textfield validation with XML Data

    hello
    can i validation a textfield with data from a XML file?
    i will read eg usernames form an XML file and will check it
    with a username was typed in in a textfield,
    if the username exits the textfield is invalid, since the
    username was typed in, is not in the XML file.
    thanks
    jack

    Hello,
    I don't advise you to make such an scenario. The solution you
    propose involve some high security risks and privacy problems
    because you send to the browser a complete list of users of your
    website.
    The Spry Validation Textfield supports callback validation
    javascript function. This means you create your own function that
    include the necessary code to validate the user input and pass to
    the widget as parameter the name of your function. A good sample of
    this feature could be seen in the
    Password
    Validation section.
    Regards,
    Cristian

  • Force Textfield Validation??

    Hello,
    I am using the Spry Text Field Validation widget to validate
    my username field in a registration form. On blur, it checks to see
    if the username exists. Is there a function I can call from that
    checking function to classify that field as invalid?
    (Make it turn pink and pop up a custom error message)
    I tried to do this manually, but then the spry validation
    doesn't work anymore.
    I suppose it would be similar to the spry:states feature;
    that you could manually classify the field as 'maxchars' or
    'invalidFormat', or in my case, 'usernameTaken'...
    Thanks alot in advance,
    Maquelly

    Hi Maquelly,
    You have to use a custom validation to do this. Your custom
    validation function needs to return true if it passes validation
    and false if it doesn't. kjuliff did something like this already
    which you can use as an example. Look at these related posts.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=602&threadid =1231854&enterthread=y
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=602&threadid =1248092&enterthread=y
    I'll file a bug to make sure we have a sample that can walk
    folks through this.
    --== Kin ==--

  • TextField validation with multiple options

    Hi.
    I am trying to create a textField widget that can have a
    number of possible correct answers. Can anyone let me know if this
    is possible. I have successfully created a textField that validates
    one answer with the use of Type Custom, but i am unsure how to have
    multiple correct answers for one textField.
    Thanks
    Barry.

    Hi Barry,
    to validate more values inside the textfield widget, you have
    to create your custom regular expression that fits with what values
    you accept for that input field.
    So your contructor should look similar with this:
    var sprytextfield1 = new
    Spry.Widget.ValidationTextField("sprytextfield1", "custom",
    {regExpFilter:/test1|test2|test3/, useCharacterMasking:true});
    This regexp is translated: the textfiled will accept only
    test1, test2, test3 values.
    You can also have this behavior if you create a custom
    function having a set of switch values:
    switch(){
    case1: ...
    case2:...
    default:false
    and you call this function as option in the widget
    constructor.
    Diana

  • Spry textfield validation for alphanumeric input

    Hi,
    How can I set the spry input to the following pattern that I need: only allow alphanumeric.

    You can build your own custom validations with Spry.
    var custom = new Spry.Widget.ValidationTextField("id", "custom", {
         validation: function( value, options ){
              return /[a-z]/gi.test( value ); // your validation
    Related reading:  http://labs.adobe.com/technologies/spry/articles/textfield_overview/index.html and http://labs.adobe.com/technologies/spry/samples/validationwidgets/TextfieldValidationSampl e.html

  • Textfield validation on values

    ALl,
    I am relatively new to Spry but I like to implement the Spry
    validation widgets in my forms.
    One of the tasks I have is checking if an entered number is
    already in my database and if so
    through an error.
    Basically checking the entered value against an array of
    numbers.
    Could some body help me get started to what the best approach
    is to this problem.
    ( I can code html and php, but my js skills are very basic)
    Thanks in advance
    KArel

    You can add the following to your onclick function and you
    should be all set.
    function postForm(YourForm)
    var val = Spry.Widget.Form.validate(YourForm);
    if (val)
    … Your post function

  • Spry textfield validation with custom pattern

    I have sussed out the standard custom pattern, and how to
    enforce it,
    but what I would like to know is how can I allow any numbers,
    including
    spaces, brackets, or plus sign, but no letters?
    This is for a phone number entry field, where it could be an
    international phone number or a standard one for the UK,
    where the
    length can vary, depending on where you live.
    http://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom)
    Any ideas?
    Dooza
    Posting Guidelines
    http://www.adobe.com/support/forums/guidelines.html
    How To Ask Smart Questions
    http://www.catb.org/esr/faqs/smart-questions.html

    V1 Fusion wrote:
    > Yes you can use regular expessions:
    >
    > function validatePhone(value){
    > return
    >
    /^(((\+44\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((\+44\s?\d{3}|\(?0\d{3}\)?)\s?
    >
    \d{3}\s?\d{4})|((\+44\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3})
    > )?$/.test(value)
    > }
    >
    > var custom = new Spry.ValidationTextField(id, "custom",
    {validation:
    > validatePhone, validateOn:["blur", "change"]})
    >
    > regexp from
    http://regexlib.com/
    Excellent, thank you, that will get me in the right
    direction. Its not
    100%, but I think I can tinker with an expression to get what
    I want.
    The number is couldn't handle is +44 (0)113 255 7666 but its
    not an
    approved format anyway, but lots of companies still do it
    this way, so I
    want to ensure I get it right.
    Thanks again!
    Dooza
    Posting Guidelines
    http://www.adobe.com/support/forums/guidelines.html
    How To Ask Smart Questions
    http://www.catb.org/esr/faqs/smart-questions.html

  • Textfield validation with more than one format

    Hi,
    I've seen in the past a solution to validate a texfield with more than one format.
    Unfortunately, I can't find it back.
    I would like to validate the format of Dutch licencenumbers.
    There are several formats like:
    AA-12-34
    12-34-AA
    AA-12-AA
    AA-AA-12
    12-AA-AA
    12-AAA-0
    one of those formats must be right for validation.
    Can sombody give a hint how to do this validation?
    Regard,
    Jan

    Thank a lot!!
    I was just forgotten to end the separate groups with a dollar $ sign.
    many thanks
    Jan

Maybe you are looking for

  • Photo stream shows constant downloading on iPhone 6.

    When going to photos on the iPhone 6, at the bottom of the screen it has been showing "downloading" since last Friday. It has not synced my photo stream from 2 weeks ago I took on my old iPhone. the MBP has them on it. The old iPhone shows them in ph

  • No multipage view of embedded pdf on iPad

    Beginning from IOS 4 some pdf pages are embeded in an htm page, so you can see only a limited view on the pdf. you can´t move the pdf behind the html page, as you can on the original and you can´t move eg. to a second pdf page. For example:  http://b

  • Target Costs- Cost Analysis

    Hi all In the cost analysis screen of the productin order display (CO03), the target costs column shows zeros for all the cost components, but it is supposed to display the target figures for the order. Any idea why all zeros are displayed? Thanks in

  • Feedback Thread: Firmware MU02 for MX100

    Please use this thread to provide any feedback for firmware MU02 for MX100. Firmware revision MU02 for the Crucial MX100 (all form factors) is now available. This firmware update applies to the MX100 SSD (all form factors), and should not be applied

  • Group Policy Not Showing Edit Options

    Server 2008 R2 Standard After installing IE 10 - 11, we are now unable to view Computer Configuration-Policies-Printers.  Also the IE9, IE10, and IE11 options are not appearing. We installed IE11eak and still no changes.  It appears that after are IE