Check a valid date in a text field

Hello allbody!

I have a challenge that seems a little tricky. I have a text field that appears as a comb of 11 characters. The user will enter numbers in the format 999999-9999. Now, I would check if FIR 6 figures are a valid date in the format DDMMYY. (the last 4 digits are random)

How can I do?

Kirstine

This must be tested THOROUGHLY. My test was very limited. Given a two-digit year validation checks only two numbers (\d\d).

Form1.Page1.Subform1.TF1::exit - (JavaScript, client)

If (!) ((this.isNull))) {}

var regEx = /^(0[1-9]|[_12][0-9]|3[01]) (0 [1-9] | 1 [012]) \d\d$/;

var str = this.rawValue;

Str = str.substring (0.6);

If (regEx.test (str)) {}

xfa.host.messageBox ("valid MMDDYY");

}

else {}

xfa.host.messageBox ("invalid MMDDYY");

}

}

Steve

Tags: Adobe LiveCycle

Similar Questions

  • Check if the number in a text field will evaluate to a date format

    I have a field FieldA, which contains 6 numbers, (even if the field is a text field). I need to know if that evaluate the numbers from the field to a real date in MMDDYY format. For example, if FieldA contains 060110, which would evaluate then to a real date from 01/06/10. However, if FieldA contains 130110, so this isn't a valid date and the test will indicate accordingly. I was thinking about using a case statement, but unsure of how to test if the numbers are evaluated to a valid date...

    Sort of:

    BOX WHEN FieldA = 'Date valid' THEN FieldA TO_DATE(FieldA, 'mm-dd-yyyy')

    Any help is appreciated...

    Thank you...
    /* Formatted on 11/14/2011 4:03:53 PM (QP5 v5.149.1003.31008) */
    CREATE OR REPLACE FUNCTION validate_date (in_dt VARCHAR2)
       RETURN VARCHAR2
    IS
    BEGIN
       FOR c IN (SELECT TO_DATE (in_dt, 'mmddrr') x FROM DUAL)
       LOOP
          RETURN 'Valid Date';
       END LOOP;
    EXCEPTION
       WHEN OTHERS
       THEN
          RETURN SQLERRM;
    END;
    
    --------------------------------------------------------------------
    
    WITH t AS (SELECT '060110' fieldA FROM DUAL
               UNION ALL
               SELECT '130110' FROM DUAL)
    SELECT CASE validate_date (fieldA)
              WHEN 'Valid Date' THEN TO_DATE (fieldA, 'mmddrr')
           END
              col1,
           validate_date (fieldA)
      FROM t;
    
    COL1     VALIDATE_DATE(FIELDA)
    6/1/2010     Valid Date
         ORA-01843: not a valid month
    

    Published by: pollywog on November 14, 2011 16:03

  • check the valid dates

    Hello

    I got a date in the format DD-MM-AA string entry. How would check date-code valid for a given year. For example, Feb should have 28 days (with the exception of leap years), Jan has only 31 days, and so on...

    Thank you

    DP

    That should do it.

    It works by converting DD-MM-YYYY to seconds and then by converting to a timestamp.  It then compares the original timestamp to the timestamp converted.  If the two are identical, it is a valid date.  If she comes back with another date, it is not valid.

    On 31 February will become March 2.  Although both have the same value of seconds, the day and month values are different, so that he knows that is not valid.

    See you soon.

  • Automatic filling of the field Date in the text field to the Format YYMMDD

    Hello

    I need to automatically populate a text field with a date that is entered in a date field. I was able to do this, but I couldn't find a way to have him fit in the text as YYMMDD field (with no spaces, dashes, etc) instead of "MM/DD/YY" as it is displayed in the date field.

    Could someone help me with the right code?

    Best regards

    ZeroZone110

    I don't know if it's the best option, but here is a workaround...

    using formcalc you can format your date fields

    var myDate = Date2Num (DateField1.rawValue, "YYYY-MM-DD")

    var format = Num2Date (myDate, "YYYY-MM-DD")

    TextField2.rawValue = format

  • Importing data to a text field - what am I doing wrong?

    I was pulling my hair out over this for half the weekend

    My ultimate goal is to read a date stored in a text file and display it in a text on my PDF page field.

    However, I'm currently stuck at the point simply import the pure text (without reformatting the date format, I want in the end).

    The text in my text file is simply a list of dates (I want to print the first in the list). Read about the function importTextdata, I added a header line with the name of text field - then the content of my text file looks like this:

    LastSyncDate

    12:17:53.54 10/09/2012

    14:23:45.32 10/04/2012

    23/07/2012 12:46:35.51

    Never

    I understand that the importTextData command is a privileged function, so I wrote a script from folder level to read the text file and store the text in a variable, which is then assigned to the text box.

    I then called the confidence function to the Document Script of the page level:

    Script folder level:

    LastSyncCalc3 = app.trustedFunction (function()

    {

    app.beginPriv ();

    var LastSync3 = importTextData ("/ C/sync/bin/LastSyncTest.txt", 0);

    this.getField("LastSyncDate").value = Lastsync3;

    app.endPriv ();

    }

    );

    Script level document:

    LastSyncCalc3();

    Execution of this displays the following errors in the console:

    importTextData is not defined

    4:document - level: SyncDate

    ReferenceError: importTextData is not defined

    4:document - level: SyncDate

    Thinking that I had misplaced orders, I changed the folder level script and the script level document as follows:

    Script folder level:

    LastSyncCalc3 = app.trustedFunction (function()

    {

    app.beginPriv ();

    var LastSync3 = importTextData ("/ C/sync/bin/LastSyncTest.txt", 0);

    app.endPriv ();

    }

    );

    Script level document:

    this.getField("LastSyncDate").value = Lastsync3;

    Execution of this displays the following errors in the console:

    Lastsync3 is not defined

    1:document - level: SyncDate

    ReferenceError: Lastsync3 is not defined

    1:document - level: SyncDate

    Where am I going wrong please?

    Instead:

    Script folder level:

    LastSyncCalc3 = app.trustedFunction (function()

    {

    app.beginPriv ();

    var LastSync3 = importTextData ("/ C/sync/bin/LastSyncTest.txt", 0);

    this.getField("LastSyncDate").value = Lastsync3;

    app.endPriv ();

    }

    );

    Script level document:

    LastSyncCalc3();

    Use this:

    Script folder level:

    LastSyncCalc3 = app.trustedFunction (function (doc)

    {

    app.beginPriv ();

    var LastSync3 = doc.importTextData ("/ C/sync/bin/LastSyncTest.txt", 0);

    doc.getField("LastSyncDate").value = Lastsync3;

    app.endPriv ();

    }

    );

    Script level document:

    LastSyncCalc3 (this);

  • Drop-down list data connection - several text fields-

    Hello to you all, guru out there. I'm new on Adobe LiveCycle, but I have some experience coding in other languages, but not of JavaScript and XML. Trying to get a user to select a client and then based on this selection, I want to return several address fields, a Contact name at the customer's location and a phone number. The data connection is an ODBC connection to our CRM software, and information are stored in a table. The user of the form will be our Service technicians, and the rest of the form will be a place to type notes about the service call. We just try to facilitate the choice of the customer for our Service technicians to rather than having to type all the information. I've searched the forums and the solutions that I keep coming across are values defined by the user in the drop-down list, I have not found an example that illustrates this with a data connection. I work from a return address field to a text field (using the command .rawValue), but I need to fill in some more information. Any guidance would be greatly appreciated.

    Thanking you in advance,

    SSCLadam

    THW way I did is to use two data connections. 1st one to fill the DDlist with a list of customers. In this one, I use simple bind to do the job. Then a 2nd connection that will extract the folder of figurines based on the selection of the DDlist. This requires the code a SQL DB to retrieve the appropriate record. To implement this data connection, I can use the provided column headers to bind columns in the fields in my form. Then when this data connection is open (I put to delayed opening) and it returns the file in question are bound fields get automagically populated!

    I've included a sample I created... .you won't have the Pb, but you can at least see what I did. The code is on the change event of the DDlist

    Hope that helps

    Paul

  • MODIFICATION OF DATA FOR THE TEXT FIELD

    Hello

    I NEED TO CHANGE THE TEXT FIELD DATA OR CHANGE THE POLICE PROMPT DURING RUN TIME.

    Kind regards

    C V S

    Hello

    Do you mean the text prompt? then replace the PROMPT_FONT_NAME by PROMPT_TEXT.

    SET_ITEM_PROPERTY('.', PROMPT_TEXT, 'COURIER NEW');
    

    Kind regards

    Manu.

    If my answer or the answer to another person has been useful or appropriate, please mark accordingly

  • Fill in the data in the text field

    Hi all
    Here, I'm a bit confused. In my page, I have three text boxes, they are - P10_YEAR, P10_MONTH, P10_TOTAL. I use LOV for year and month field. LOV is as for the year 2000, 2000, 2001; for the month of June 2001; June, July. ; July and so on. Month field is set to textbox to validate.
    So I want to recover the data in the P10_TOTAL when the user selects the month. Interestingly, it always returns 0, but it should be more than that. I put the Source for P10_TOTAL as PL/SQL Expression * 0 = (SELECT count (*) from rtv_metro_count where record_month =: P10_month); * but it does not work. However, it does not work in the sql query and the toad. I tried to change the SQL query expression, but doesn't work anymore.

    Is there another way, I can run this task, retrieve data from the table in a specific text field? Please provide your suggestions.

    Thanks in advance.

    Djelloul

    Create a process page - on submit using the following code:

    DECLARE
    v_count NUMBER;
    BEGIN
    SELECT COUNT (*)
    IN v_count
    OF rtv_metro_count
    WHERE record_month =: p10_month;

    : p10_total: = v_count;
    END;

    and eliminate the source of pages by assigning static assignment - only when the current value in session state is set to zero.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • 4.1 pass data to the text field new page deletes the data after colon

    I work with APEX 4.1 in Amazon RDS, an upgrade is not possible.

    The problem is that if I click on a link in my report and pass the description field to the next page in a section of the text, if there are two points in the data, any data that was in the description after the colon disappear. The research that I did suggest to disable the app escapes in safety, but that seems to work only for version 4.2, the option does not appear in the 4.1.

    Usually, I prefer to use a record id rather spend a bunch of string from one page to another. However, you can try to use a collection to store the values of passage. Once the new page is loaded, you can extract the value from the collection in the element you are interested in.

  • data duplicated in text fields - and or digital

    How to avoid enter the same variable data in a PDF form. I don't want that the user must write the text several times in copies of page a formfields form PDF to Page 2 with the same fields of text and digital.

    Gr8 all the best.

    Regards-

    Chalukya.

  • DateChooser - get Date to a text field

    I hope it's a simple question. How can I get the date on which a person clicks on a field of text using the Datechooser component?

    I have it!

    String (Sprite (1).) SelectedDate.GETDATE ())

    Now, if I can figure out how to remove the '. '. 0000"in the end, I put...

    Thank you for your patience at all.

  • As to print the xml data in the text field in palco

    segue o código seguinte para abertura maintains xml:

    XML follows the following code for the opening of the archive:

    var carregador:URLLoader = new URLLoader();    
    carregador.addEventListener(Event.COMPLETE, emCompleto, false, 0, true); 
       carregador.load(new URLRequest("http://localhost/arquivo.xml"));   
    function emCompleto(evt:Event):void
    { 
        var dadosXML:XML = new XML(evt.target.data);
         // Obtendo valor do atributo... // Getting value of the attribute…
          texto = dadosXML.pessoa[0].@id;
          trace(texto);
         // Exibirá "cliente" // Will show " cliente"
      } 

    is there a question?

  • How to remove line empty when the data are not for a text field

    I created a PDF with Acrobat Pro 11 model. This model has an address of the employer with the address line 1, address line 2, city, State, zip code, country. The requirement is to show address line 1 and line 2 address in separate lines and address line 2 cannot be present always. If address line 2 is not present then the PDF should not show a blank line. How do I get there?

    These data are populated through xml by a publisher of BI. New line characters do not work.

    Appreciate your help on this.

    Hi sprphoto123,

    If you do not enter data in the text field 2 then you can set the form field property to is not mandatory, but if you want to disable the 2nd text field, you can add a check box in front of it to turn off the field. This can be achieved using JavaScript.

    Kind regards

    Nicos

  • XML data in the question text field

    LC ARE 8.2.1.3

    I have a web service that returns XML data and designer calls the Web service and the XML data meet a text field.  It works very well.

    My problem is getting the data out of the text field to fill in the various fields in my form.  I have done a lot of research and have tried many different things but still can't get out the data.  I did that my form is dynamic xml.

    This is the last thing I tried:

    -Begin Code-

    Place in testData: initialize and the connectionSet is placed in Page1:Initialize.

    var myXML = XMLData.parse (xmlData.rawValue, false);

    var subNames = XMLData.applyXPath (myXML, "//Subordinates/Subordinate/full_name");

    If (subNames == null) {}
    No data
    } Else if (subNames.length == null) {}
    No picture, just a single value
    topmostSubform.Page2.testData.addItem (subName.value);
    } else {}
    for (var i = 0; i < subNames.length; i ++) {}
    topmostSubform.Page2.testData.addItem (subName.item (i) .value);
    }
    }

    -Code of end-

    I worked on it for 3 days and still can not make it work.  The closest I came is out in my testData field that says "Object23485968".

    Thanks in advance for your help

    John

    I forgot the file ACL

    Paul

  • I have two text fields, where the user will sign a text field and the other text field should be mandatory

    I have 2 text fields, and how can I do a condition when the text 1 field is entered, then they must enter data into the text field 2.  I know it seemed simple, but I'm just a beginner in this... Thanks in advance!

    Hello

    I'm sorry, I forgot this matter.

    Please try this code...

    If (this.isNull)

    {

    TextField2.validate.nullTest = 'error ';

    }

    on the other

    {

    TextField2.validate.nullTest = "disabled";

    }

    Hope than that,

    S, candy.

Maybe you are looking for