Set a Limit in Using a Comb in a Text Field

I have a Text Field that has a Comb of 6 characters. The uses should input either a 5 or 6 characters in this field. Is there a way to give an error message if the user does not input at least 5 characters?
Thanks for you assistance,
Parre

Try this code in the Exit event of the field with JavaScript as the language..
if(TextField1.rawValue.length<5){
xfa.host.messageBox("The field length should be minimum 5 characters");
xfa.host.setFocus(this);
Thanks
Srini

Similar Messages

  • Limit the amount of characters of a text field based on first digit

    Hello and thanks in advance for your help!
    I would like to limit the amount of characters of the text field based on the first digit of the number (the text field is only limited to a number format...no decimals, no commas).
    For example, if the number begins with a 3, I would like to limit the text field to allow only ten characters. I have three scenarios but if I could get started with some code and what is the best place to add it (keystroke or validation?) I can take it from there. Thanks again for your help!!

    I've written this code for you that does that. Use it as the field's custom Keystroke code:
    // Validate that only digits are entered
    if (event.change) {
        event.rc = /^\d+$/.test(event.change);
    // Validate string length if it starts with 3
    if (/^3/.test(AFMergeChange(event))) {
        event.rc = AFMergeChange(event).length <= 10;
        if (!event.rc) app.alert("If the number starts with \"3\" it may not be longer than 10 digits.",1); // optional error message
    You can duplicate the second part of it for additional conditions, but keep in mind that this code won't even let you remove the first character in the field if the result is an invalid one.
    For example, if you enter "234567890123456" then you can't remove the "2" at the start because that would result in an invalid number. You can remove any of the other digits, though, and when it's 10 digits or less then you could remove the starting "2" as well.

  • How do you limit the amount of digits in a text field?

    If a user was to input 9 digits into a text field. How do you make it so that an error message would appear if the user inputs more than 9 digits

    That code will set the TextFields length to 9 standard charecters (might not be 9 though) To limit the number of charecters and throw an error message I would use a listener on the textField. Perhaps a keyListener that keeps track of the number of charecters. ( swing has document listeners which are really nice )

  • Do I need to use javascript to get a text field in a PDF form to aut fill with current/today's date?

    I have a form for booking appointments and would like the date field to automatically fill with
    today's date and to print. I have set the text field's format to "Date" and when I place the cursor into the
    date field, today's date shows. It disappears as soon as I tab to the next field.
    Does this action require a javascript script to fill and print today's date? If so, where do I find that?
    Or is there another way to format the text field (besides typing today's date) to get the current date?
    Thanks.
    Ali
    using iMac 2.93 GHz Intel Core 2 Duo 8 GB | OS Snow Leopard 10.6.8 | Acrobat Pro 8

    Thank you GKaiseril!
    From the examples by Chris Dahl, I edited the script in the text field editing dialog to reflect the title I had given the field. That fixed the problem of today's date disappearing as soon as I tabbed to the next field.
    How do I choose for document level or page open script? I would like it to insert the date upon opening the document.
    Thanks again.
    Ali
    NOTE: I found the answer within Chris Dahl's tutorial... path is for Acrobat Pro 8: Advanced>Document Processing>Document Javascripts

  • Report error when using combo box and one text field is empty

    I'm building an interactive pdf in adobe pro 9. My problem is the following: I have one text field where you can enter a numeric code and that is used to populate another text field when I choose an option on one combo box.For example: suppose I write the code 123 in the text field "A" and that the combo box has two options ("data" and "-"). When I select "-", another text field "B" is empty, while when I select "data" i populate the text field "B" using the code entered "A" with the text "data_123". In order to do this I use the standard javascript code in the Format>Custom tab of the combo-box.
    My questions are:
    - how can I prevent the pdf to proceed selecting an option in the combo box when the field "A" is empty?
    - how can I update the field "B" every time that I change the text in "A"? I found that the text is "B" is updated only when I press the selection in the combo box.

    You can set the combo box to read-only in the Validate event of the A field:
    // Validate script for text field
    getField("combo1").readonly = !event.value;
    To update the value of B when A changes, you can expand the script above to something like:
    // Validate script for text field
    var f1 = getField("combo1");
    var f2 = getField("B");
    // If there is an entry in the A field...
    if (event.value) {
        f1.readonly = false;  // Make sure the combo box is activated
        f2.value = f1.value === "-" ? "" : "fa.value + event.value;  // Update the value of field B
    } else {
        f1.readonly = true;  // Deactivate the combo box
        f2.value = f2.defaultValue;  // Reset field B
    You might also want to reset the combo box somewhere in there, but it's not clear to me when you would want to do that.

  • Set the number of lines allowed in multi-line text field

    Hi,
    I am designing a form where I have some multi-line text fields where I only want the user to be able to enter a maximum of say 5 lines. I know I could do this by enabling the "Limit Length to Visible Area" option, however, this option is ignored by Reader 7 and the field scrolls, hiding any text that spills beyond the visible area from printouts. It works great in 8 though. To avoid this bug/feature in Reader 7, is there some script that I can use to limit the number of lines allowed in a text field?
    Thanks

    I ran into similar issues switching between Acrobat/Reader. Here is the prominent code that works for me when I use this in "Enter" event of the textField.
    var aSOM=this.somExpression.substr(15,this.somExpression.length - 1);
    var acroField = event.target.getField(aSOM);
    acroField.doNotScroll = true;
    I chose Allow Multiple Lines alone and noting else.
    Good Luck,
    SekharN

  • How do I use Javascript to populate a text field based on a selection from a drop down box?

    Greetings,
    I have virtually no experience with JavaScript and I am trying to figure out how to add some basic automation features to an Adobe form.  I have a drop down box called "Hospital_Name" that will contain approximately 7 possible selections.  When the user makes a selection, I would like to have the text field (called "Hospital_Address") below the drop down box populate with the corresponding address for the selection.  I have the "Hospital_Address" text field configured for multiple lines and would like the address to have a line break between the street address and the city/state/zip.
    For example, if the user selected "Hospital 1", the text field would display:
    123 Main St
    Anytown, CA 12345
    Any help or examples you can provide would be greatly appreciated.

    You have the element names within the object within brackets.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    // some debugging code to see location names;
    console.show();console.clear():
    for(I in Location) {
    console.println(I);
    // end debugging code;
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;
    This is not a beginners task but requires a fair amount of knowledge about the structure of objects, defining strings, and structure of arrays.
    Are you sure you have all the field names correctly spelled and capitalized?
    Do you get any error in the JavaScript console?
    Just trying the line that defines the "Location", I get the following error:
    SyntaxError: invalid property id
    1:Console:Exec
    undefined
    All the form field in a PDF are processed by using JavaScript and any error in any script will stop JavaScript processing.
    It might help to have a link to the problem form.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;

  • Using plugin to display a text field

    How can I use plugin to display textfield?              

    It's a bit more complicated than you probably would expect: You need to
    load the AcroForm HFT and then execute the JavaScript to create your text
    field via the the AFExecuteThisScript() function.
    Karl Heinz Kremer
    PDF Acrobatics Without a Net
    [email protected]
    http://www.khkonsulting.com

  • Using Javascript to change multiple text field names

    I have a pdf with multiple text fields. I need to change all the text field names (General -> Name) so that they are unique so that when I combine multiple pdfs together, the text fields will stay intact. Is there anyway to do this using javascript? Thanks!

    I'm new to javascript too...it will be very helpfull for me too...Thanks
    poltrone
    prodotti chimici

  • How to change the font used to fill in a text field.

    Can you please tell me how to change the font that comes up when a text field is filled in?
    Can I change this setting in InDesign or does it have to be done in Acrobat?

    It must be done in Acrobat. InDesign only allows Times Roman for some reason.
    To change it in Acrobat 11, open the PDF and select: Tools > Forms > Edit
    and select the field(s) you want to change, bring up the field properties dialog, and look on the Appearance tab for the font dropdown.

  • How to change the font used to fill in a text field in an interactive form.

    Can you please tell me how I can change the font that comes up when you go to fill in a text field in an interactive PDF?
    Can this be set in InDesign or does it have to be done in Acrobat?

    Only in Acrobat. Tools > Forms > Edit. Double-click on the text field to change its Appearance.

  • Guideline for Using 40 Char in Short Text Field of Material Master

    Dear Experts & Forum Members,
    In MM01 while creating a Material Master record (spare part) we need to fill in Basic Data. It has a field known as "Short Text Field " This Field has limitation of 40 characters. This is the same field which has Searched associated with it. This description is what we see when we look for Stock Overview of Material in the Stores through MEMBER.
    To use this 40 characters efficiently people usually come up with a guideline so that maximum and meaningful information crucial information for identification of spare part/material is VIEWED when we see it.
    For example for an AC Motor the description may look like
    *MOTOR AC SQ 100KW 1500 RPM 8P CLA FRXYZ
    which describes AC Motor, Squirrel Cage Type, 100 KW, 1500 RPM, 8 Pole, Class A, Frame Size XYZ
    Request the forum members to provide / share any guideline they might have come up with to use these 40 characters to describe different spare parts.
    Thanks in advance for your help.
    Regards
    Vinay
    Edited by: VINAY MAITHANI on Jul 15, 2010 6:51 PM

    Hi Vinay,
    We are also doing the same activity and we are arranging the material description in a manner which is almost simlar to you.
    But, except one thing which is Classification. We have classification feature mapped with material master for the details of Dimension,Brand,Color and Orgin.
    For further commets, rever back.
    Regards,
    NAK
    Edited by: abdul kader on Jul 28, 2010 9:36 AM
    Edited by: abdul kader on Jul 28, 2010 9:38 AM

  • Using an array to define text fields

    I am developing a fairly simple program that will calculate the relationship of say a basketball player's height to his number of rebounds. It will display residual output, a graph, and many other things related to statistics. However, I have run into a problem.
    I want the user, at the very first screen, to use my combo box to define the number of pairs of data points he has in his relationship. So if he clicked on 10, the next screen would display 20 text fields, an X and a Y for each data point. My problem is I cannot create a user-defined amount of text fields in a for loop. If I use an array, string[count], to use as the name, it will not let me.
    Any suggestions or do I need to elaborate more?

    This would be the code for where I try to create the JTextFields.
    for(int count = 0; count<(2*getValue()); ++count)
    private JTextField values[count] = new JTextField(6);The array values[] simply contains values from 1-60. It will not allow me to use an array to name the JTextField.
    Also, I am not familiar with the List class. It sounds interesting, and it may be what I need.
    Sorry if that is not exactly the right code; I am not at my personal computer at the moment.
    Message was edited by:
    greenspacechunks

  • Use addChild to create a text field but cannot get its height

    Hi,
    I am using addChild to dynamically creat text components
    Text() . But I when I access its height property, it is always 0
    even though the text is wrapped around. Has any one seen similar
    things and have a solution?
    Thanks!

    If I call the method that check the height of the newly
    created text objects in a button (i.e., click=""), it works. So it
    maybe a timing issue: should wait for the creation of the children
    to be all done?
    So, how do I add a even handler to check the finish of each
    addition the text object?
    Thanks!

  • Splitting of text fields when using multiple fonts within a text field and exporting it to XFL.

    Hi All,
    I have been trying out  InDesign and exported files to XFL for use in Flash. If I use a single font for a text box then everything looks fine in flash, but if  I use multiple fonts for the same text box its split into multiple text boxes. For making this more clear I have attached an image.
    Any help to resolve this!!!

    Paragraph styles are tied to the paragraph, not the page.
    You don't say which version you are using, but here's something you could try in CS3 or CS4. Set up a baseline grid in the preferences to match the main pages. The spacing should match the leading of the body text. Make a special paragraph style (you can base it on the body text style) that you will apply to text onthe chapter start page, and as part of that style set it to align to baseline grid. Now for the trick. Select the  text frame onthe start page and define a custom baseline grid with the spacing you want. Save it as an object style, too, while you're at it. The strating text should align to the custom grid on the start page and the documetn grid on the next page.
    Peter

Maybe you are looking for

  • Problem to maintain the Comments in BW 7.3 Integrated Planning

    Dear All, Can anybody please guide me to complete the " Flexible Comment Solution for BEx Applications."  As I am working on BW7.3 SP8 and was gone through the documents " How to Flexibly Change Characteristic Values and Comments in BI Integrated Pla

  • TS2755 Problem with sending pictures

    I am having a problem sending pictures to an e-mail account on my i-phone.  Does anyone know if I need to change a setting or why this is happening?

  • BBP_EXTREQ_TRANSFER

    I kindly request your help with an issue that I am facing. The scenario is as follows : 1. There is a non valuated material X (material type UNBW). 2. MRP run happens and generates a PR with account assignment U. 3. Transfer report BBP_EXTREQ_TRANSFE

  • Customization of Subject Line in SAP Learning Solution Notification

    Hi I had a requirement of generating notifications in SAP Learning Solution. The notifications should be automatically posted to the recipients through Email. The above portion is working fine. However, I just wanted to know, <b>Is there a way to cus

  • Single email sent but activity window reports multiple messages

    When I send a single email sent the activity window reports sending of multiple messages e.g. 9.  Does this indicate a virus or malware is working in the background and if so what should I do about it?