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

Similar Messages

  • 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

  • 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

  • I am facing error while running Quickpay in Fusion payroll that "The input value Periodicity is missing for element type KGOC_Unpaid_Absence_Amount. Enter a valid input value". Any idea?

    I am facing error while running Quickpay in Fusion payroll that "The input value Periodicity is missing for element type KGOC_Unpaid_Absence_Amount. Enter a valid input value". Any idea?

    This is most probably because the Periodicity input value has been configured as "Required" and no value has been input for it.
    Please enter a value and try to re-run Quick Pay.

  • Error - '' is not a valid boolean value

    I have been receiving the error message = '' is not a valid Boolean value quite frequently.  It doesn’t matter which hierarchy I am in but it’s typically when I do an Add or Insert.  When selecting ‘ok’ on the error message, I’m able to continue on with my work but was just curious what causes this error.  Sometimes when this error shows up and I click ‘ok’, it will take me out of the DRM screen and into whatever else I may have open at the moment.  Any thoughts or ideas?  We are on version 11.1.1.2.103

    As Murali stated-
    It could be a property incorrectly configured, check all the boolean type properties and see if any of them are getting a string value by any chance.
    Thanks
    Denzz

  • JSF select one menu keeps giving me summary=Validation Error: Value is not

    Hi all,
    I'm using five select menus in a JSP file.
    the other four are populated whenever the first menu changes its value (ValueChange event).
    after the menus are populated, i select a item in each menu and submit it.
    but when i submit the form i get the following error:
    E com.sun.faces.context.FacesContextImpl addMessage Adding Message[sourceId=form2:menu61,summary=Validation Error: Value is not valid)
    [12/1/06 11:25:58:541 EST] 00000030 jsf           E com.sun.faces.context.FacesContextImpl addMessage Adding Message[sourceId=form2:menu5,summary=Validation Error: Value is not valid)
    [12/1/06 11:25:58:557 EST] 00000030 jsf           E com.sun.faces.context.FacesContextImpl addMessage Adding Message[sourceId=form2:menu6,summary=Validation Error: Value is not valid)where menu61, menu5, menu6 are the menus on the form.
    someone pls throw some light on this.
    -Seshu

    Hi,
    Since you are using a request scoped bean things work like this:
    1. You fetch your list, for example from a database, with a bean that is put in request scope.
    2. You populate your select component on the jsp page.
    3. You select an item in the select component and submits the form.
    4. When the form is submitted the selected value has to be validated against the list it was chosen from. Since you retrieved the list from a bean in request scope the list isn't available when you submit the form and the getter for the list probably returns an empty list which gives you the validation error.
    What you have to do is to get the list the item was selected from when submitting the form. This can be done in different ways. Either you keep your list in the session between the requests or you get the list from your data storage again. This is a horrible "feature" with JSF and from what I know it's impossible to turn this validation off.
    /klejs

  • 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

  • Script Data Component - System.DateTime.TryParseExact Method not validation date value

    Hello
    I have Script data component in my data flow task and i am trying to validate whether the date fields has valid date values or not.
    So i added below code to validate the date fields
    in below code TestDate is datetime and ValidTestDate is datetime as well.
    string[] formats = { "MM/dd/yyyy", "MM/d/yyyy", "M/dd/yyyy", "M/d/yyyy"};
    DateTime pDateTime;
    if (System.DateTime.TryParseExact(Row.TestDate.ToString(), formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out pDateTime)==true)
                    Row.ValidTestDate = Row.TestDate;
    System.DateTime.TryParseExact is not validating to true even the TestDate is valid.
    I have even tried converting the datetime field to DT_DATE but it did not work.
    I appreciate any suggestion to accomplish the check whether it is valid date or not.
    Regards
    Harris

    This is because the string value of TestDate does not conform to either of the formats.
    Arthur
    MyBlog
    Twitter

  • Validating input values in Entity

    Hi,
    Is there any drawbacks while validating Input values in Entity object ?

    As your business logic remains in the model layer there is always some kind of entity level validation (at least the DB constrains are checked by the DB). There are other validations which don't touch EO at all. One is e.g. input parameters for ViewCriteria which may need to meet some conditions. As there is no EO involved you have to either make the check in the VO before executing the view criteria or you do it on the UI (if you can).
    Some simple checks are always done in the UI (e.r. required).
    So in summary you have to do validation on all levels, it just depends what you want to check. As a rule of thumb all validation which are part of the business logic should be define there (e.g. EO). ADF allows you to simply define such validation which are then enforced on the data.
    Timo

  • 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.

  • How can I modify the application- validation- set- value validation

    Dear all :
    After I created a new value set( application->validation->set->value validation), I want to change the Type of the "value validation",how can I modify ?
    Regards
    Terry

    Dear all:
    Sorry, I found the answer in the metalink note :[ID 396369.1]     
    Regards
    Terry

  • 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>

  • Validation of values in an input field.

    Hello togther,
    I've created an input field with a value-selector, so that the user can choose a value from help-list. But he can also enter a value directly into the input field. Is there any "STANDRAD" method to check whtether the value which is in the input field is valid against the values from the value-selector?
    I've found a standard method to check whether  mandatory fields are field and the method works fine. Is there anything like this also for checking values against values from the selector?
    Thanks in advance.
    Greetings,
    Florian

    Hello Florian,
                           You can create an event CHECK_DATA  for OnEnter event of  you input field.
    Then go to the Action tab and select the action type as Validation-Independent .
    Hope this will work for the input field with OVS help .
    Regards
    Vivek

  • 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

Maybe you are looking for

  • Photoshop CC 2014 crashes when trying to create a panorama from Lightroom?

    Hi, I have both Photoshop and Lightroom CC installed. When I pass 6 photos from Lightroom to Photoshop CC to create a panorma, Photoshop goes through the throws, imports the images, generates the panorama then crashes, with a message from Windows say

  • Is there a way to view my print history?

    Hello out there,          I recently printed an important document from the internet but i did not save it to my computer. I am not able to view what i printed from that website so i am wondering if there is a "print history" similar to Safari's "web

  • Photo iView in another iView

    Hi all! We have a problem showing photos of employees in a home made CV iView. The pictures are currently stored using standard document handling in SAP so there are standard procedures to "retrieve" the pictures. There is an iView called "Photo", in

  • Which is better iPod nano 7th gen or iPod touch 4th gen

    I currently have an iPod touch 2nd gen 8 GB.  I can no longer update it nor download from iTunes.  I also do not have enough memory for all my videos and music.  So I am considering buying a new one.  I basically only use my iPod for music and videos

  • ERM Field name issue.

    Hi All,        Having issue in ERM Text variables. While scheduling the job or in job history we are not able to see the variable name like Job number or connector name in job history, in-spite of that we are seeing the Java coding name like "#_!CONN