Validate month number as text

I am trying to validate a text field so that it only accepts the month in numerical form with a leading zero if less than 10. The data type is Text Field, the value is  “User Entered - Required” and the Validation pattern is 99.
I have the following code:
----- topmostSubform.Page1.DateMM::exit: - (JavaScript, client) --------------------
if (this.isNull) {
    xfa.host.messageBox("Field cannot be blank!");
else {
    if (xfa.event.commitKey == 2){
        if (this.rawValue >= "01" && this.rawValue <= "12") {
            xfa.host.setFocus("DateDD");
        else {
            this.rawValue = "";
            xfa.host.messageBox("Please enter month number between 01 and 12");
----- topmostSubform.Page1.DateMM::validate: - (JavaScript, client) ----------------
if (this.rawValue >= "01" && this.rawValue <= "12")
    true;
else
    this.rawValue = "";
    false;
----- topmostSubform.Page1.DateMM::change: - (JavaScript, client) ------------------
if (xfa.event.commitKey == 2){
        if (this.rawValue >= "01" && this.rawValue <= "12") {
            xfa.host.setFocus("DateDD");
        else {
            this.rawValue = "";
            xfa.host.messageBox("Please enter month number between 01 and 12");
Since the field is required, I want the message “Field cannot be blank!” to be displayed if when entered on the field and nothing is entered. If validation doesn’t pass (month from 01 to 12), delete the text and display error message. As it is now The validation seems to work, but the error messages are not showing except the “field cannot be blank”. If I enter incorrect text I get the “Field cannot be blank” twice.

Put this code on the exit event of the field. If the user enters a single digit then a 0 will be added.. Make sure the field is a numeric firld and it is set for an integer. This will make sure the user cannot enter a letter.
if (this.rawValue.length < 2){
this.rawValue = "0" + this.rawValue
if ((this.rawValue > 12) || (this.rawValue < 1)){
app.alert("The field must conatain a value from 01 - 12")
this.rawValue = ""
xfa.host.setFocus(this.name)
Paul

Similar Messages

  • How to validate the number of characters in Text Entry box?

    Hi
    I have inserted a text entry box and assigned a variable (UserName) to it. Now, I need to limit the entry to a maxinum number of 20 characters. In other words, how do I validate the number of characters in the text entry box and provide feedback if it is more than 20 characters?

    Thanks.
    I have posted this as a query on the relevant post on Jim's website. I am too new to regular expressions. I hope he will help with an example as well.
    http://captivatedev.com/2012/07/31/adobe-captivate-6-x-widget-text-entry-box-validator/
    Sreekanth

  • Is there an APP to monitor call usage and number of texts sent

    Is there an APP to monitor call usage (in minutes) and number of texts sent etc so I can ensure I am keeping within my contract? I am getting my 3GS on Thursday so do not know if the phone has this facility already inbuilt or whether there is an app I can buy to do this for me?
    Thank you for any help and info to answer my question.

    Unless O2 has an app available via the iTunes app store that provides for this as AT&T does for the iPhone sold in the U.S., I don't believe so.
    The iPhone includes a usage indicator for Call Time and Cellular Network Data usage, which can be reset on a monthly basis based on your billing cycle, but there is no usage indicator for the number of messages sent or received.

  • I want to validate multiple input type=text with spry validation any one hepl me?

    I want to validate multiple input type=text with spry validation any one hepl me?
    my code is as below plz help me
               *Professional Experience             Years        Months                             

    Read;
    http://labs.adobe.com/technologies/spry/articles/textfield_overview/index.html
    http://labs.adobe.com/technologies/spry/widgets/textfieldvalidation/SpryValidationTextFiel d.html
    and check out the samples:
    http://labs.adobe.com/technologies/spry/samples/

  • CVP Opsconsole: Patterns for RNA timeout on outbound SIP calls - Dialed Number (DN) text box does not take any input

    Hi there,
    I'm having problems modifying the 'Dialed Number (DN)' text box under 'Advanced Configuration->Patterns for RNA timeout on outbound SIP calls' of the SIP tab in the Cisco Unified Customer Voice Portal 8.5(1) opsconsole. In a nut shell, I need to change the RNA timeout but some reason when typing into the Dialed Number text box, the input is not taken. The reason I want to change this settings is because my ICM Rona is not working with CVP:
    https://supportforums.cisco.com/thread/2031366
    Thanks in advance for any help.
    Carlos A Trivino
    [email protected]

    Hello Dale,
    CVP doesn't allow you to exceed the RNA more than 60  Seconds. If you want to configure the timer for DN Patterns you should  do it via OPS console, It would update the sip.properties files in  correct way, the above way is incorrect.
    Regards,
    Senthil

  • How can i validate current row input text field like required.

    Hi All,
    jdev 11.1.2.1.0
    in my use case i have drag drop one viewobject as a adf table. and in table i have also add one extra input text field which is not based on
    vo.
    now i want to validate current row input text field not null when i commit row.
    but when i using required property true. it worked for all row in table. problem is that i want only current row input text field validate not all
    thanks,
    Manish

    When the user tries commit the data by clicking on the button -- For that button, have the logic in the actionlistener method to check if the additional input field is NULL or NOT.
    If it is NULL, show an error message using FacesContext.addMessage() API.
    Thanks,
    Navaneeth

  • Uploading a text file with unknown number of  texts

    Hi ,
    i have a flat file with around  10,000 record's.
    each material number  followed by  different  lengths & unknown number of text's separated by delimiter '$',
    that need to be saved using save_text function module.
    the file is as follows, 
    record 1 :     material1$text1$text2$text3
    record 2 :     material2$text1$text2$text3$text4$text5$text6$.....
    record 3 :     material3$text1$text2$text3$text4$text5
    record 4:      material3$text1
    - - - - - - - - - - - -  so on ....
    i created the following  structure ,  to split and save each text separated by '$'  , to save in TLINE  of save_text function module.
    types : begin of ty_file,
                  matnr type mara-matnr,
                  text1 type string,
                  text2 type string,
                  text3 type string,
                  text4 type string,
                  text20 type string,
               end of ty_file.
    i have uploaded the file and saved in table  it_file type ty_file.
    loop it_file into wa_file.
       split wa_file at '$' in to matnr text1 text2 text3 text4 ....... so on.
    endloop.
    please, suggest me an alternate way to reduce the code, instead of creating a structure like above, so that each splitted text
    stores in a single variable and is passed to TLINE of corresponding material, in save_text function module
    thanks
    viki

    Hi,
    The flat file contains , material No. followed by it's text , each text sepearted by '$' symbol.
    For each material  i have to get all lines of text, and passed to tables paramter of save_text.
    The Number of text' for each material is varying.
    Please kindly suggest me , how many variables i need to create to hold each splitted text and store it in Tline
    I wrote the below program assuming that the material number has  maximum of 20 texts, it's working fine. But, what if the number of texts exceeds 20.
    file :
    4907507$ Druckrolle$ Durchmesser: 218 mm$ Länge: 750 mm$ Rollenwerkstoff: 1.4301/1.4541$ Oberfläche: gummiert$ Stärke Gummierung: 10 mm$ Näscher    E 71224$$$$$$$$$$$$$$                              
    1149598$ Tragrolle$ mit Stützringen$ Norm: ähnlich DIN 22112$ Durchmesser: 89 mm$ Mantellänge: 800 mm$ Form der Achsenden: A2$ Achsdurchmesser: 25 mm$ Achsanflachung: SW 18$ Einlegelänge: 808 mm$ Achslänge: 834 mm$ Lagerbezeichnung: 6305$ Anzahl Stützringe Form A: 6$ Anzahl Stützringe Form B: 4$ Anordnung links: 4$ Anordnung mittig: 6$ Anordnung rechts: 4$ Qualität Stützringe: N$ Durchmesser Stützringe: 159 mm$ Anzahl Zwischenhülsen: 7$ Anzahl Schlussscheiben: 2$ Erbö   3111.800.05.68                                                                      
    file upload
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          static    = 'X'
        CHANGING
          file_name = p_infile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME            = gd_file
          FILETYPE            = 'ASC'
         HAS_FIELD_SEPARATOR = 'X'
         HAS_FIELD_SEPARATOR = '$'
        TABLES
          DATA_TAB            = It_data.
      loop at it_data into wa_data.
        split wa_data-line at seperator into matnr_txt text1 text2 text3 text4 text5
                                                   text6 text7 text8 text9 text10 text11
                                                   text11 text12 text13 text14 text15
                                                   text16 text17 text18 text19 text20.
        move matnr_txt to wa_material-matnr.
        move text1 to wa_material-text1.
        move text2 to wa_material-text2.
        move text20 to wa_material-text20.
        append wa_material to it_material.
        clear wa_material.
      endloop.
      loop at it_material into wa_material.
        WA_LINE-TDFORMAT = '*'.
        WA_line-TDLINE = wa_material-text1.
        APPEND WA_LINE TO IT_LINE.
        WA_LINE-TDFORMAT = '*'.
        WA_line-TDLINE = wa_material-text2.
        APPEND WA_LINE TO IT_LINE.
        WA_LINE-TDFORMAT = '*'.
        WA_line-TDLINE = wa_material-text20.
        APPEND WA_LINE TO IT_LINE.
        G_THEAD-TDNAME   = wa_material-matnr. " material number
        G_THEAD-TDID     = pa_id.                           "  'GRUN',
        G_THEAD-TDSPRAS  = pa_langu.                "  EN
        G_THEAD-TDOBJECT = pa_obj.                   "  MATERIAL
        CALL FUNCTION 'SAVE_TEXT'
          EXPORTING
            CLIENT                           = SY-MANDT
            HEADER                        = G_THEAD
            SAVEMODE_DIRECT     = 'X'
          TABLES
            LINES           = IT_LINE
          clear : wa_line, g_matnr.
          refresh it_line.
      endloop.
    Edited by: jvsvijay on Jul 28, 2011 12:51 PM
    Edited by: jvsvijay on Jul 28, 2011 12:53 PM
    Edited by: jvsvijay on Jul 28, 2011 12:55 PM

  • How to get the current month number

    Hi everyone,
    Does anybody know how to get the current month number in Oracle Discoverer Worksheet calculation?
    I try to use EUL_DATE_TRUNC(CURRENT_DATE, 'MM'), but instead I got 01-AUG-00.
    If I change the data display format to MM, it will give me "08" but if I use TO_NUMBER function to convert it to number I get error "invalid number"
    Is there anyway to get the current month value in number? Thanks

    Scott,
    Thank you so much! It works perfectly! :)
    Hope you have a great day ahead!
    Cheers,
    Angeline

  • How to output money number by text in java?

    How to output money number by text in java?
    Example: input: 1234 $
    output: one thousand two hundred thirty four dollar.

    try this...
    import java.text.DecimalFormat;
    public class EnglishNumberToWords {
      private static final String[] tensNames = {
        " ten",
        " twenty",
        " thirty",
        " forty",
        " fifty",
        " sixty",
        " seventy",
        " eighty",
        " ninety"
      private static final String[] numNames = {
        " one",
        " two",
        " three",
        " four",
        " five",
        " six",
        " seven",
        " eight",
        " nine",
        " ten",
        " eleven",
        " twelve",
        " thirteen",
        " fourteen",
        " fifteen",
        " sixteen",
        " seventeen",
        " eighteen",
        " nineteen"
      private static String convertLessThanOneThousand(int number) {
        String soFar;
        if (number % 100 < 20){
          soFar = numNames[number % 100];
          number /= 100;
        else {
          soFar = numNames[number % 10];
          number /= 10;
          soFar = tensNames[number % 10] + soFar;
          number /= 10;
        if (number == 0) return soFar;
        return numNames[number] + " hundred" + soFar;
      public static String convert(long number) {
        // 0 to 999 999 999 999
        if (number == 0) { return "zero"; }
        String snumber = Long.toString(number);
        // pad with "0"
        String mask = "000000000000";
        DecimalFormat df = new DecimalFormat(mask);
        snumber = df.format(number);
        // XXXnnnnnnnnn
        int billions = Integer.parseInt(snumber.substring(0,3));
        // nnnXXXnnnnnn
        int millions  = Integer.parseInt(snumber.substring(3,6));
        // nnnnnnXXXnnn
        int hundredThousands = Integer.parseInt(snumber.substring(6,9));
        // nnnnnnnnnXXX
        int thousands = Integer.parseInt(snumber.substring(9,12));   
        String tradBillions;
        switch (billions) {
        case 0:
          tradBillions = "";
          break;
        case 1 :
          tradBillions = convertLessThanOneThousand(billions)
          + " billion ";
          break;
        default :
          tradBillions = convertLessThanOneThousand(billions)
          + " billion ";
        String result =  tradBillions;
        String tradMillions;
        switch (millions) {
        case 0:
          tradMillions = "";
          break;
        case 1 :
          tradMillions = convertLessThanOneThousand(millions)
          + " million ";
          break;
        default :
          tradMillions = convertLessThanOneThousand(millions)
          + " million ";
        result =  result + tradMillions;
        String tradHundredThousands;
        switch (hundredThousands) {
        case 0:
          tradHundredThousands = "";
          break;
        case 1 :
          tradHundredThousands = "one thousand ";
          break;
        default :
          tradHundredThousands = convertLessThanOneThousand(hundredThousands)
          + " thousand ";
        result =  result + tradHundredThousands;
        String tradThousand;
        tradThousand = convertLessThanOneThousand(thousands);
        result =  result + tradThousand;
        // remove extra spaces!
        return result.replaceAll("^\\s+", "").replaceAll("\\b\\s{2,}\\b", " ");
       * testing
       * @param args
      public static void main(String[] args) {
        System.out.println("*** " + EnglishNumberToWords.convert(0));
        System.out.println("*** " + EnglishNumberToWords.convert(1));
        System.out.println("*** " + EnglishNumberToWords.convert(16));
        System.out.println("*** " + EnglishNumberToWords.convert(100));
        System.out.println("*** " + EnglishNumberToWords.convert(118));
        System.out.println("*** " + EnglishNumberToWords.convert(200));
        System.out.println("*** " + EnglishNumberToWords.convert(219));
        System.out.println("*** " + EnglishNumberToWords.convert(800));
        System.out.println("*** " + EnglishNumberToWords.convert(801));
        System.out.println("*** " + EnglishNumberToWords.convert(1316));
        System.out.println("*** " + EnglishNumberToWords.convert(1000000));
        System.out.println("*** " + EnglishNumberToWords.convert(2000000));
        System.out.println("*** " + EnglishNumberToWords.convert(3000200));
        System.out.println("*** " + EnglishNumberToWords.convert(700000));
        System.out.println("*** " + EnglishNumberToWords.convert(9000000));
        System.out.println("*** " + EnglishNumberToWords.convert(9001000));
        System.out.println("*** " + EnglishNumberToWords.convert(123456789));
        System.out.println("*** " + EnglishNumberToWords.convert(2147483647));
        System.out.println("*** " + EnglishNumberToWords.convert(3000000010L));
         *** zero
         *** one
         *** sixteen
         *** one hundred
         *** one hundred eighteen
         *** two hundred
         *** two hundred nineteen
         *** eight hundred
         *** eight hundred one
         *** one thousand three hundred sixteen
         *** one million
         *** two millions
         *** three millions two hundred
         *** seven hundred thousand
         *** nine millions
         *** nine millions one thousand
         *** one hundred twenty three millions four hundred
         **      fifty six thousand seven hundred eighty nine
         *** two billion one hundred forty seven millions
         **      four hundred eighty three thousand six hundred forty seven
         *** three billion ten
    }

  • Is there any way to link page number with the reference page number within text in InDesign CC and CS6?

    Is there any way to link page number with the reference page number within text in InDesign CC and CS6?

    You should ask in InDesign
    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • How to validate customer number in FD32 initial screen

    I need to validate customer number in FD32 initial screen. It should allow only Payers but not sold to

    I  think  you wont get MIC no instandard SAP

  • Have a month number but QaaWs query will not run

    If I type in the parameters for the query it runs with no problem, but when I use the MONTH function that returns the month number the query will not run.
    I think the date serial number is what is being passed even though I see a number being display.  Does anyone know how to conver this MONTH() function to a true number?  This is a converted 4.5 model that works just fine, but looks like they tightened things up in 2008.
    Thanks...
    Tom Nather

    Here is how its setup.  I have a QaaWs query that returns the max date, then Excel functions that calculate the date back 13 months.  One of the functions is MONTH() that returns the month number based on a date stored in a cell, not really a true number.
    I added a vlookup that takes the month from a date field (05/31/2008) and looks up the appropriate NUMBER of the month =VLOOKUP(MONTH(K47),M54:M65,1). Find 5 (which is defined as a number.
    This then is applied to the input side for the Qaaws (Month Number = double) using a Paste Link function from the CONTROLS sheet in excel, and the query then works.
    Anything that is a date always seems to be built off of the date serial number so this was the easiest way to get this to work. 
    I think standards have been tightened up using the Flex language vs. what 4.5 was written in, this works in 4.5 without the necessary conversion.

  • Diffrence between when-validate-item and post-text-item trigger

    What is the Diffrence between when-validate-item and post-text-item trigger, when they are written for the same item and the basic diffrence between when-validate-item and post-text-item trigger.

    Two big differences:
    1. post-text-item is only available to, and only triggered when leaving a text item, whereas when-validate-item is triggered by the forms validation process, and is available for any item type.
    2. p-t-i is a navigation trigger and you cannot invoke it programmatically, whereas the 'validate' built-in can be used to execute validation which fires the w-v-i trigger(s).

  • Current month's full text

    Hi all
    Is there any function module to get Current month's full text?
    E.g: If current date is 01.08.2007.. then I want the full text as "August" (Not the short form "Aug")
    Pls help
    Regards,
    Prasad

    Use table t247 to read text.
    There are two fields one for short & other for long, pick accordingly.
    select SINGLE * from t247 into itab where mnr = month
    AND SPRAS = 'E'.
    But from FM check this thread -
    creating routine
    Regards,
    Amit
    Reward all helpful replies.

  • I got a new ipod touch and when I went to text it used my Dad's number.  I want to use our family's itunes account (for music etc) but have my own id/number for texting.   What do I do?

    I got a new ipod touch and when I went to text it used my Dad's number.  I want to use our family's itunes account (for music etc) but have my own id/number for texting.   What do I do?

    See:
    MacMost Now 653: Setting Up Multiple iOS Devices For Messages and FaceTime
    You will not have a phone number, only an email address.
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage

Maybe you are looking for