How can I validate numeric values in a text field?

Hello

Once more, I have a problem.

I have a field in which the user must enter 10 digits in the model 999999-9999. The field should contain only numbers and must be exactly 10 characters. I have a validation script on the button "print", which prevent printing if required fields are empty or not properly filled out.

I tried two ways of working this point, and I'm not satisfied with any of them, I can always print despite warning messages and validation scripts.

1.

I put the type numeric field, limited to 11 characters.

Display model num {999999-9999}, change the model num {999999-9999} and validation model num {999999-9999}

Problems using this solution: when I type 11 digits in the field (ex.12345612345) I get a warning message and 12.345.612

But when I type 9 digts (e.g. 123456-123 or 123456123) I get no message warning and 000000-0000 or 012345-6123

If I type alphabetic characters (e.g. 123456 abcd) I get no warning message and 000000-0000.

2.

I put the field in the text field, limited to 11 characters.

The model text {999999-9999}, edit text model {999999-9999} and {999999-9999} model validation

Now, when I type 11 digits in the field (ex.12345612345) I don't get any warning messages and 12345612345

When I type 9 digts (e.g. 123456-123) I get no warning message and 123456-123

When I type 9 digts (e.g. 123456123) I get a warning message and 123456123

If I type alphabetic characters (e.g. 123456 abcd) I get a warning message and 123456 abcd.

It works a little better as a text field, but I'm not satisfied at all.

Someone at - there a solution to this?

Additional I also want the hyphen to emerge automatically when you type.

K

Regular expressions are useful for this type of validation. The code below tf1 is a text field with a maximum length of 12.

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

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

var FO = this.rawValue;

\d to match any character in the range 0-9

regExp var = \d{6}\-\d{5}/;

If (!) () {regExp.test (tf)))}

xfa.host.messageBox ("the field must be in the format of 123456-12345.", "Validation", 1);

}

}

{The \d{6}\-\d{5}/ expression tests 6 digits \d{6}, a dash-- and 5-digit \d{5}.

Steve

Tags: Adobe LiveCycle

Similar Questions

  • Data clean on a numeric value in the text field

    Hello team,

    There is a field called 'turnover' in our Eloqua instance. It is a text field, but contains mostly numeric values synchronized in the same field of SFDC. The SFDC field is numeric.

    I am trying to write a program of standardization of data that uses the "Annual sales" value to update another field, "standardized annual income", with the value appropriate for example Strip $0 to $5 M, $5 - $10 M, $10 / $20 M...

    I created a rule to update that search values:

    • between 1 and 5000000 "turnover" and updates the "standardized annual income" field of $0 à $5 M
    • between 5000001 and 100000 in the "Annual income" and updates the "standardized annual income" field $5-$10 M
    • and so on...

    However when I test it I get the correct value in 'annual standardized income. " I also tried using filters to make contacts with the "annual income" values between 0 and 5000000 but I get all kinds of values outside this range.

    Can someone tell me where I'm wrong? Is it because the data type of the field 'Turnover' is the text rather than digital? I guess I could create a new numeric field for "Annual income", write values existing in this area and change the SFDC integration but I would avoid it if possible. If anyone has any bright ideas, I'd love to hear them.

    Thank you

    James

    For anyone interested, I got the answer from the Support. As it is established as a text field that eloqua is trying to make an alphabetical "between" rather than a digital "between". As it is not possible to change the data type of a field, I need to create a new digital field, export the data to the existing field (as well as email address) and upload again to the new field.

  • Validate the value of the text field

    Hello.

    I found this code:

    the value of power reactive

    var a = this.getField ("Name1");

    var two = this.getField ("Name2");

    var 3 = this.getField ("Name3");

    This feature assembles two field values into one with "and" as a separator.

    function concatFields (field1, field2, fieldDest) {}

    make sure that all variables are present

    If (Field1 & & Field2 & & fieldDest) {}

    var fieldVals = new Array();

    If (field1.value! = "& & field1.value! = null) {}

    fieldVals.push (field1.value);

    }

    If (field2.value! = "& & field2.value! = null) {}

    fieldVals.push (field2.value);

    }

    fieldDestResult = fieldVals.join ('and');

    fill the fieldDest only if it is empty

    if(fieldDestResult.value!=''|| fieldDestResult.value!=null) {}

    fieldDest.value = fieldDestResult;

    //}

    }

    }

    concatFields (one, two, three);

    These values to combine text two fields into one (text field nr.3) and put 'and' between the values. It works OK. But what happens if the two values are equal? Then, I need that one value is fill in field Nr. 3. Then. If the field 'Name1' and 'Name2' values are different, the two are combined in "Name3",... If the values are equal, the only one of them will be send to "Name3" on the ground.

    How can I do?

    Thanks for the reply.

    There is no coma have been a period should be. Be the soul of the last four lines:

    var Text1 = this.getField("Name1").valueAsString;

    var Text2 = this.getField("Name2").valueAsString;

    if(Text1 == text2) Text2 = "";

    Fill-in = Event.Value (Text1, Text2, "", "and");

    Additional code can be added to remove the distinction uppercase / lowercase and trim leading or white end space.

  • How can I change the contents of a text field in a PDF form with a defined variable?

    Hi all!

    First time poster and getting quite frustrated trying to understand this issue. Here's the scenario: I use Acrobat Pro 10 to create what is essentially a form of giant order. I have designed the document in InDesign, defined the various buttons and other whatnot and then it exported to Acrobat to continue the construction of the form.

    I have a radio button group called 'conference_opportunities' that contains different options at different prices, so they are all the same, but have different values (so that they belong to the same group and only one can be selected at a time).

    What I've done is created a 'MouseDown' event on the button that sets a variable called 'ConferenceOpportunity', which is equivalent to the title of the option they pick. Then, I want to take this variable and display in a text box called "Conference_Option". I use a variable because my radio buttons values are actual prices of the option they pick, so I can't set the value as the title of the option.

    If its an array of boxes and option at the bottom of the page, there is the Option that they selected, the quantity (which can change) and value (in dollars)

    I also then want to display this variable at the end of the document as a kind of summary of what they have chosen to buy as well, but I guess it's the same code.

    I'm not an expert at all Javascript, so code snippets would help greatly. I looked on the Document from Adobe on the SDK and API and have not been able to find a solution. I also turned to the Almighty google and still no luck.

    Any help would be greatly appreciated!

    Thank you all

    Right now, you have to do is use this variable to the value property of your text field... Then add this at the end of your code:

    this.getField("Conference_Option").value = ConferenceOpportunity;

    Also, I would use not MouseDown, MouseUp.

  • How can I make a box autopopulate a text field

    I have 2 text fields named MailingAddress and GarageAddress.

    I would like to have a check box next to my MailingAddress the field when checked would be autopopulate my GarageAddress with the value of MailingAddress.

    I scrounged around forums and cobbled this together (with my very limited knowledge of JavaScript)... but get a syntax error.  I'm sure it's something obvious... If you understand JavaScript!

    Any help would be greatly appreciated

    var aMailing = this.getField ("MailingAddress");
    var aGarage = this.getField ("GarageAddress");

    If (this.getField (event.target.name) .value is 'Yes')
    {
    copy the mailing address to the address of Garage;
    aMailing.value = aGarage.value;
    }
    aGarage.readonly = true; do GarageAddress readonly;
    }

    on the other

    {
    aGarage.readonly = false; clear readonly
    this.resetForm ([aGarage.name]) / / reset GarageAddress
    }

    You have syntax errors in your code. Also, it seems that the logic of your code is reversed. You copy the value of GarageAddress to MailingAddress, instead of what you have described. I suggest using this code (as the MouseUp event of the checkbox) instead:

    var aMailing = this.getField("MailingAddress");
    var aGarage = this.getField("GarageAddress");
    
    if (event.target.value == "Yes") {
        // copy Mailing address to Garage address;
        aGarage.value = aMailing.valueAsString;
        aGarage.readonly = true; // make GarageAddress readonly;
    } else {
        aGarage.readonly = false; // clear readonly
        this.resetForm([aGarage.name]) // reset GarageAddress
    }
    
  • How can I change the caption on a text field using data?

    Hi, I have read that it is possible to do, but when you have an xsd file, I use a data xml file preview, so there is no way to link them together, any ideas?

    Thank you!.

    (1) in the designer, tools > Options

    (2) in the left pane, select data binding and display dynamic properties is checked

    (3) to select the field you want the legend to be driven by XML

    (4) in the object palette on the field tab you will notice Caption is now green and underlined, click it.

    (5) If your form is bound to a schema you can see the hierarchy when you press the button next to the entry link or in your case to access the Caption attribute in your XML type > $. textField1.Caption

    Assuming that "$" is your root node.

    Kyle

  • Referring to the value of a text field, not the legend

    How to refer to the value in a text field to make the data entered by the user "BOLD" / no fat without the caption of a field text in bold or not bold?

    Hello

    Two lines should do. The first turn the caption and the "BOLD" value, then the second changes the legend of back to normal:

    TextField1.font.weight = "bold";
    TextField1.caption.font.weight = "normal";
    

    Hope that helps,

    Niall

    Ensure the dynamics

  • How can I validate the data in the control file?

    Consider that the SQLLoader reads the data entry of the path file and loads the data in the base tables up on top of the description specified in the control file.
    First, the form is created:

    create table sql_loader_1 (load_time date, digital Champ_1, Champ_2 varchar2 (10))
    Example of control file:
    load_1.CTL

    load data
    INFILE "load_1.dat", "str"\r\n"
    insert into table sql_loader_1
    (
    load_time sysdate,
    Champ_2 position (01:10).
    Champ_1 position(11:20)
    )
    Note that positions 11 to 20 are loaded in positions 1 to 10 in Champ_2 and Champ_1. The load_time field is filled with time current (sysdate) load.

    Here is the data. The name of the file (load_1.dat) had been specified with the statement for infile in the control file.

    load_1.dat

    0123456789abcdefghij
    **********##########
    foo bar
    This is a very long line
    and the next one is
    short

    declared the Champ_1 as a numeric data type, but the input data file contains the data "Sue"(position 11:20) so the sql loader adds not the record to the database instead the record is written in the bad file. But I want to validate the data of the "(position 11:20) is digital or not." How can I post this in the control file itself? If it is not possible, how can I validate it in the database? give me a sample code to explain this

    Here are two ideas.

    Idea 1: This control file will check to see if the data to be loaded in Champ_1 contains a number (including the negative and decimal).

    load data
    infile 'load_1.dat' "str '\r\n'"
    insert into table sql_loader_1
    (
    load_time sysdate,
    field_2 position( 1:10),
    field_1 position(11:20) "decode(trim(translate(:field_1,'-0123456789.',' ')),null,:field_1,-999)"
    ) 
    

    If Champ_1 is a number or null, it is passed through, as is. If there is no numeric characters (in addition to '-'and'.') a distinct value-999 will be inserted for you allow to load the rest of the columns and easy to see the lines had data that cannot be loaded in Champ_1. This idea has its flaws (a string like "... ("will always drain the .bad file)

    Idea 2: Load the data into a staging table first (or define an external table) where all columns are VARCHAR2. Then use SQL or PL/SQL to validate data in the staging table in your process to move the data into the table with the actual data types.

  • How can I change the value of a control on front panel?

    On the front panel, I'm doing a complex control that consists of a Slider control and control of the digital inputs. Both controls display the same information and either may be used for entry. When changing value, I want the other control to display the same value.

    How can I change the value of a control on front flap when another control changes the value? I know how to use a structure of the event to detect value has changed, but I do not know how to impose control on front panel to change its value in the block diagram.

    Why do you not use a digital display on the slider, and no code is required:

    EDIT: Yes, he said. ***

  • HOW CAN SOMEONE VALIDATE MICROSOFT WINDOWS ONLINE?

    How can someone validate windows genuine 7, 8, 10 online? / What is the secure link to validate windows genuine 7,8,10 online anytime?

    Visit our page what to look for on the Microsoft How to Tell website...

  • How can I write the value of floats Unitronics vision230 PLC with modbus Ethernet

    How can I write the value of type Float in unitronics PLC Vision230 modbus ethernet (Ethernet Master Query.vi MB) usinsg I read and write register 32 bits, for example, I want to write the value 23.45 2nd Add. MF. And registry MF is the 32-bit registry. I read and write register 32-bit.

    Narendra.

    Narendra,

    Two characters can type cast into a uint16 you VI supports.

    To summarize. Take one (4 bytes). Flatten it to a string (4-byte) divided this string into two parts of 2 bytes each. Cast in u16 (16 x 2 = 32-bit).

    However, if you really want to follow the IEEE standards then you will need refer this KB. His is not that simple, but seems closer to what you are looking for.

    Amit

  • How can I validate my copy of Windows XP

    I am trying to create a copy of mssstool32 on a cd but it takes imapi v2. but it says that I have to validate my XP first.
    How can I validate it?

    http://Windows.Microsoft.com/en-us/Windows/help/genuine/what-is-validation

    Click Validate now on the right side.

  • How can I set default values to set the Mode in the config of the AO?

    Hi, how can I set default values to allocate mode in the config of the AO. To be precise, in the attached vi, I need to set the Mode allocate in the AO Config to ' use FIFO memory (6) ' if the value inside the structure of my case is false and 'no change (0)' if the value inside the strusture case is true.

    Create two constants for Mode allocate input (right click > create > constant). A place in the real case of the structure of the case and place it in the case of false. Their son in the same tunnel (border of the structure of the case), then the tunnel of wire to the pole to allocate the AO Config Mode. I do not have traditional DAQ installed, but who should do it.

  • How can I change the value of a print job in Visio 2003. It is for 1 or 2 pages, I want that he 9 printing pages. Thank you.

    How can I change the value of a print job in Visio 2003.  He is currently configured to print pages 1 and 2, but I want to print all 9 pages at a time.  Thank you

    You can remove 1-2 and type 1-9? All HP and Epson printers I have worked this way.

    That's all I can offer as I'm not familiar with your printer.

  • Please how can I insert a value of richinputtext in the database string attribute

    Please how can I insert a value of richinputtext in the database string attribute

    If you can get its value at the bean and then call your insert statement to put it in the DB table

    and if you want to know about the execution of SQL query

    then check - Ashish Awasthi (Jdev/ADF) Blog: SQL to run in an ADF Application using DataSource DBTransaction & JDBC query

    Ashish

Maybe you are looking for