Create Acrobat with JavaScript form field and restrict numeric values only

Hello

I use a JavaScript loop to create a number of similar form fields. I'm trying to restrict the data entered in these fields of numbers only. I am able to validate the figures who are registered, but the fields still accept text, I don't want to. How can I make sure that text is not accepted?

Script:

var x 1 = 53;
var y1 = 358;
var x 2 = 123;
var y2 = 340;

for (var i = 1; i < 18; i ++) {}
var name = "MyField" + i;
var type = "text";
var page = 1;
rental var = [x 1, y1, x 2, y2];
myField var = this.addField (name, type, page, location);
myField.textSize = 10;
myField.setAction ("Post", "AFRange_Validate (true, 0, true, 100) '");
myField;
Y1-= 18;
Y2-= 18;
};

For example, if you want to display 2 digits to the right of the decimal separator with a comma of any currency symbol, thousands separator, you need to add:

myField.setAction ('Format', ' AFNumber_Format (2, 0, 0, 0,-"\", false); ");

myField.setAction ('Touch', ' AFNumber_Keystroke (2, 0, 0, 0,-"\", false); ");

Tags: Acrobat

Similar Questions

  • Need to concatenate the put date in the form field and the numeric field

    Hello

    I have a date field and a 4-digit numeric field in my form. I want to concatenate these fields in a new field in the following format: "YYYYMMDD [4-digit numeric field]."

    For example

    Date: June 4, 2015

    Number: 1234

    Concatenated field: 201506041234

    When I try to concatenate the value of date, I get the string value is entered instead of the actual date (e.g. "4 June").

    Thank you.

    OK, the script might like:

    Get the values of field as strings

    var sDate = getField("date1").valueAsString;

    Var Nums = getField("number1").valueAsString;

    Convert string to date in a date object

    Kai var = util.scand ("mm/dd/yyyy", sDate);

    Concatenate number and the date strings

    var sDateNum = util.printd ("YYYYMMDD", letter) + nes;

  • How to allow the addition of attachments and more filled in form fields and signing existing signature field

    How do to allow the addition of attachments and more filled in form fields and signing of signature field when creating a secure pdf document?

    You must allow commenting as well. Reader users will be able to add attachments as comments. You can also use JavaScript with Player 11 and DC to automate the process somewhat.

    If you need users of Reader in order to add attachments as Acrobat can, you need to add the right of use of file attachments, but you can't do that with Acrobat.

  • Labels for form fields and calculations

    Help, please!  I use Acrobat XI. I have 2 buttons that the user needs to check and I can't seam to label. I would like more than a label of reversal. My research is said to go to properties > Options and label here as a label and a name are different. Labelling is not an option for me here. I have two choices: stye and Radio button selection button.   Help, please!  Also, I tried to said the tax rate of NC of 6.75% for the resident of NC button and we found that I have to add a java script in the actions of a field AND an export value to check the properties of the area, is that correct? Could someone explain PLEASE.  Essentially, I have a subtotal box and to add sales tax (a different - when box checked) and come with the order total.  Thanks a lot for your help. Best regards, titi

    The last line should be:

    If (taxable! = "Off") {event.value = subtotal * tax_rate ;}} else {event.value = ' ' ;}}

  • Order of the form fields and the name (without CB) in Email

    Hi fans of Muse.

    I have little problem set. order of fields in form of Muse and naming in the submitted e-mails.

    There is a simple form (for a subscription to the newsletter) with 3 fields (tags are off): name, surname and email address.

    Muse site is not hosted on BC and everything works fine (emails sent, name and email are delivered) except these things:

    1. the subject of the email subject is "submission of form XY. Is it possible to change the subject?

    2. in the presentation of muse, I have 1 the name field (for the first name), then a single line filed for the name field, then the email field.

    But the delivered mail reads as:

    Name: XY (First name)

    Email: email

    Custom: XY (family name)

    Is it possible to change the order and rename the fields correctly?

    Thanks in advance

    CPT Hoschi

    The label used in the enamel, is the same thing as the label used in the form of Muse, even if the label is hidden, so you can change your last label of the name "custom" for "last name" field and which should improve the email you get.

    In regard to the order of the fields in the email doesn't match not in order on the page, I think it's a bug of Muse. Muse currently generates e-mail based on the order of the fields in your form, rather than the order from top down. You should be able to affect the order of fields in the e-mail by selecting the individual form fields and choosing "send to back" or "leading" in the menu object.

  • Acrobat - 'Plus' sign showing on some form fields and others don't

    Hello

    We have built a PDF for a customer who has a number of form fields. Some are same line but most are multiline fields. Everything works well except that on some areas, views "overflow indicator text' and on the other is not.

    We cannot predict the length of the text (it will take overflow on most fields) so they need to be a fixed height. It looks like Acrobat is struggling to understand what fields have 'overflow' text and then sometimes displays the indicator and sometimes is not even if the fields themselves are identical. I know that we can stop the indicator to display in our individual preferences, but this wont be any good for the recipients that we cannot say to each user for that turn on or off.

    Any guidance appreciated! Is there a way to disable this flag for end users?

    Since you use Acrobat, you are more likely to get a useful response if you ask in the forum of Acrobat.

  • Enter the text for the form field and do to repeat in the following pages

    Hi - I'm working on an interactive form of 14 pages. There are two text fields that must appear on the bottom of each page.

    Anyone know if it is possible for the user to these fields in competition once and while the text automatically repeat on the following pages?

    I create the form in InDesign CS6 (I CC, but it runs like a turtle).

    Any help much appreciated! Thank you.

    Form fields with the same name will have the same value, so just name them

    Similarly.

    Duplicate a field on several pages is easily achievable in Acrobat, by the way.

    There is a built-in function that allows you to do when you right click on a shape

    in form editing mode.

  • Calculated field with the currency formatting, and hiding the values null

    I am designing a PDF form for quote and I have a field defined to multiply the amount of an article and the unit price to the total price.  There are 5 lines on each quote, and if users are citing only 1 or 2 items I want the values null in fields unused price extended to be hidden.

    I did it with the following script

    If (event.value == 0) event.value = ";

    But when I enter the quantity and total price of price is displayed as a regular number (100) instead of currency ($100).

    I can format to currency with

    Event.Value = util.printf ("$%.2f", event.value);

    I don't know there's a way to combine to give rise to such a situation then, so if the field is 0, make null and if not then format as currency but I don't know how to do it.

    Any help would be appreciated.

    Andrew

    Newer versions of Acrobat hide zero for fields values using the number format and with a currency symbol. »

    But since you can't control the updating of user systems, you must use a small function documented for formatting numeric fields on the fly.

    With the extended price field set to 'None' format, you can add the following script to the Validation script "Custom" or add it to a custom JavaScript calculation. The "Custom Validation will work with any method of calculation. Note that the form must be cleaned or recalculated to see the result of the validation script change.

    if(Event.Value == 0) {}
    Event.Value = ""; set the field value to null to a value of zero
    AFNumber_Format (2, 0, 0, 0, "", true); number with no currency symbol format
    } else {}
    AFNumber_Format (2, 0, 0, 0, "$", true); for the format of the values non-null for number with the currency symbol
    }

    The positional parameters are the number of decimal places, the Style separator, negative value Style, Style of (unused) currency, currency symbol, the currency symbol Pre-hanging chain.

  • A web site can generate PDFS filled by downloading a PDF file with empty form fields?

    In other words, if I provide my web developer with a standard form PDF file that is ready to be filled, can code the site to "fill" the form fields with the data generated by a release of the database?

    Here's the goal: I need to have nice aesthetically "certificates" generated by the web site for the print client. The design is approved, but the customer does not want to have to fill them all individually. We have the data, and I'd love to be able to 'plug in' on individual PDF files. The question is, can 'take' the data that a user in Acrobat Pro/Reader/DC of PDF software? A web site "tool" can be coded to fill the fields of the PDF format and save a printable file?

    Keep in mind, I'm a designer, so I probably don't have a response technical, more just one "Yes, you can do this using the...» "or a 'of course not, silly designer guy, it would be a huge security risk' or whatever, so that I can know whether or not to have my web devs continue this as a solution.

    Yes, it is possible, but not with Acrobat, which cannot be used on a server.

    There are other tools that can do it, even if the side server.

  • Please help with dynamic form field names in cfloop

    Hello

    I need to create a form with day, date, month, year and time for 12 months

    Instead of coding them 12 times, I create fileds day, date, month, year and hour in my form 1 time, then I use cfloop from = "1" to "12" = index = 'i' to these fields in form loop 12 times.

    I gave each form field name such as: < input type = "text" name = "' ScheduleDate_ # I #" value ="" > this way, each of these fields will be named differently: ""

    ScheduleDate_1, ScheduleDate_2, ScheduleDate_3, ScheduleTime_1, ScheduleTime_2, etc.

    I am facing problem when this form is sent, I think that the error has something to do with the number sign (#) when it comes to update the back-end

    I use MS SQL

    He doesn't like this:

    < CFLOOP From="1" To="12" index="k">

    < CFIF Len(Trim(Form.MeetYear_#k#)) NEQ 0 AND Len(Trim(Form.MeetTime_#k#)) NEQ 0>

    < cfquery name ='CreateSchedule' datasource =' #DSN # '>

    UPDATE TableSchedule

    The VALUE SchedDay = < cfqueryparam cfsqltype ="cf_sql_varchar" value ='#form. SchedDay_ # k'>.

    SchedMonth =

    < cfqueryparam cfsqltype ="cf_sql_varchar" value =' #form. . "AnnMonth_ # k '>.

    SchedDate =

    < cfqueryparam cfsqltype ="cf_sql_varchar" value =' #form. . "SchedDate_ # k '>.

    SchedYear =

    < cfqueryparam cfsqltype ="cf_sql_varchar" value =' #form. . "AnnYear_ # k '>.

    SchedTime =

    < cfqueryparam cfsqltype ="cf_sql_varchar" value =' #form. . "Anntime_ # k '>

    SchedId = < cfqueryparam cfsqltype ='cf_sql_numeric' value =' #k # '>

    < / cfquery >

    < / CFIF >

    < / CFLOOP >

    Can anyone help please?

    You cannot nest sharps. Do this instead:

    SET SchedDay =

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

  • How to create bookmarks with javascript?

    Hello!

    I have a question about the creation of boomarks with javascript.

    I use the following line to create bookmarks:

    this.bookmarkRoot.createChild (words [i], ' pageNum = one "" ");


    The problem is that the bookmarks are created but all lead to the same page.

    Get the complete code:

    / Put the title of the script here.

    var string2 = [];

    string2 = "Word, example; test. "

    Var words = words.split(";");

    var N = words.length;

    for (i = 0; i < N; i ++) {}

    pageArray var = [];

    var string = words [i];

    for (variety p = 0; p < this.numPages; p ++) {}

    for (var n = 0; n < this.getPageNumWords (p); n ++) {}

    If (this.getPageNthWord (p, n) is {words [i]})

    pageArray.push (p);

    a = pageArray [0];

    this.bookmarkRoot.createChild (words [i], ' pageNum = one "" ");

    break;

    }

    }

    }

    }

    Any help is very appreciated!

    It seems that the variable a is useless and only one line:

    this.bookmarkRoot.createChild (words [i], 'pageNum = "+ p);

  • Update database with several form fields with the same name

    If I've made good progress on my CF photo album project, but now I meet a problem.  Once I downloaded a collection of photos and them inserted in my database, I bring up a page that is actually an array containing the thumbnail of each image, some info on it and the description of the photo.

    The table is inside a < form > tag, and the description is a < textarea > tag.  I have many text boxes that I have pictures, so there may be any number (within reasonable limits).  I'd like to be able to type a description for each picture in each text box rather than having to do one at a time, and then click the button submit to update my file.

    Each text box has the same name, so I had the idea of adding a hidden form field that held the photo ID, then on the processing page, I might have a < cfloop >.  My problem is that I can not understand how to associate each photo with the corresponding description ID, especially if we consider that some of the descriptions may be empty.

    Is there a good way to do this?

    As you probably understand, giving all your textareas eponymous means that when the form is submitted, you get a value that is a list of the contents of each text box comma-delimited.  If none of the commas are typed in the text box, you have a problem.

    My preferred method is to include some sort of identifier as part of the name of the form field.  Since you have ID photo available, I would use those.  This would give your names textareas as description_111, description_112, etc.

    When the form is submitted, I loop through the form.fieldnames list.  If the first 12 characters are 'description_111', I can remore 12 characters to get the id.  I also have the content of the text box using the array notation.

  • Intelligence with sub form table and filtering of Ajax

    Hi all

    I manually built a tabular presentation with a client, registration and a checkbox to select those whom we want to choose for a given operation. It is very good and works fine, however, the customer list is very long and I am wanting to get a little clever with it and put in place Ajax filtering with a search field.
    This works also very well - I used the method described in the book 'Pro Oracle Application Express' (for those who don't have it, someone's blog the exact method, Word for Word, here) and the filtering works brilliantly, but the problem is with the checkboxes.
    I want users to be able to filter the list, a few boxes, re - filter the list and check a little more and then submit with all the parts retained and submitted.
    As is the nature of the Ajax call, all the boxes are deleted whenever you update the search filter string.

    Can someone suggest a method to achieve what I'm trying to do here?

    Thank you!

    Hello

    You may have a hidden page element (one that "saves the State") which contains a list of values for the checkboxes checked and updated immediately before the Ajax call. This article begins with a ': ' then add the value like ":" for each checked item - that would give you a string like ': 1:2:3: ' when the page is sent, you can then use STRING_TO_TABLE to get your list.

    The javascript code would be something like:

    function updateCheckedItems()
    {
      var x = document.getElementsByName("f01");
      var xx = document.getElementById("P1_CHECKED_ITEMS");
      var c;
      var v;
      if (x)
      {
        for (c = 0; c < x.length; c++)
        {
          if (x[c].checked)
          {
            v = x[c].value;
            if (xx.value.indexOf(":" + v + ":") == -1)
            {
              xx.value += v + ":";
            }
          }
        }
      }
    }
    

    This assumes that your boxes have a name of "f01" attribute, and the hidden item is P1_CHECKED_ITEMS

    Andy

  • create proxy with clips in mxf and multichannel?

    'Create proxies' with audio 8 channels (4096 x 2160 MXF AVC H.264 codec XAVC, only 2 registered channel) does not work. How can I solve this problem?

    This presets you try and what exactly is a failure?

    I tried a few clips XAVC with 8 audio channels (only the first two channels actually had audio) and create Proxies worked for me using the default QuickTime ProRes and GoPro CineForm presets, so a custom preset DNxHD.

    Are - what you happened to use the H.264 preset and get an error in the events Panel? (The selected preset does not support the type of audio channel of the clip). If so, what is expected, such as H.264 export / transcode does not support 8-channel audio.

  • How to create a model of form field?

    It does not exist in the new version of the Document cloud? I would like to be able to add layers of form field to sign an invoice where account information is going to be different everytime I use the form - so the standard model will not work.

    Thank you!

    Hello Ttimmer,

    The form field layer is always available under the section of the template to create. Here is the reference for help:

    https://helpx.Adobe.com/document-cloud/help/reusable-form-field-layer.html

    -Usman

Maybe you are looking for