Multiple Form Field Validation

I run throught these series of checks before submitting the variables to the .jsp script. Problem is that it will ignore the sender name and receipient name as long as there are two email addresses. Why is that?
if (sendername eq "") {
        nameerrorTXT.text = "PLEASE ENTER YOUR NAME";
    if (emailfrom.indexOf("@")<0 or emailfrom.indexOf(".")<0) {
        emailfromerror.text= "PLEASE USE A VALID EMAIL ADDRESS";
        emailfromTXT.text = "";
    if (recipientname eq "") {
        recipientnameerrorTXT.text= "PLEASE ENTER YOUR FRIEND'S NAME";
        recipientnameTXT.text = "";
    if (emailto.indexOf("@")<0 or emailto.indexOf(".")<0) {
            emailtoerror.text= "PLEASE USE A VALID EMAIL ADDRESS";
            emailtoTXT.text = "";
    } else {
        _root.sendername = sendername;
        _root.recipientname = recipientname;
        _root.emailfrom = emailfrom;
        _root.emailto = emailto;
        _root.emailsubject = sendername + " " + emailsubject;
        _root.emailbody = emailbody;
        _root.loadVariables("/jsp/sendMail.jsp", "POST");
        sendernameTXT.text = "";
        recipientnameTXT.text = "";
        emailfromTXT.text = "";
        emailtoTXT.text = "";
        nextFrame();

Thanks Klad,
I actually tried that route. The problem was that if any one of those 'if' statements were true the the function would stop and I needed the function to check AND respond to each field if needed. I found that the 'else' statement would fire regardless to all the 'if' statements except for the one just before it.
I'm sure there is a better way to do and I'd like to know how but I solved the issue by creating a last 'if' statement that lumped all the if statements together. This way I would achieve the error feedback needed AND keep the 'ELSE' statement from firing. See below
submitBNT.onPress = function(){
    if (sendername eq undefined | sendername eq "") {
        nameerrorTXT.text = "PLEASE ENTER YOUR NAME";
        sendernameTXT.text = "";
    if (emailfrom.indexOf("@")<0 | emailfrom.indexOf(".")<0) {
        emailfromerror.text= "PLEASE USE A VALID EMAIL ADDRESS";
        emailfromTXT.text = "";
    if (recipientname eq undefined | recipientname eq "") {
        recipientnameerrorTXT.text= "PLEASE ENTER YOUR FRIEND'S NAME";
        recipientnameTXT.text = "";
    if (emailto.indexOf("@")<0 | emailto.indexOf(".")<0) {
            emailtoerror.text= "PLEASE USE A VALID EMAIL ADDRESS";
            emailtoTXT.text = "";
    if (sendername eq undefined | sendername eq "" | emailfrom.indexOf("@")<0 or emailfrom.indexOf(".")<0 | recipientname eq undefined | recipientname eq "" | emailto.indexOf("@")<0 or emailto.indexOf(".")<0) {
        /// DO NOTHING
    } else {
        processMailForm();

Similar Messages

  • Is it possible to create a form with multiple form fields on a single line?

    Is it possible to create a form with multiple form fields on a single line?  I can't find anything in the documentation or a template that does this.
    I am trying to create a "documents received" checklist with a check box on the left margin, a date-received field to the right of the check box and and a description of the document (Formatted Text) on the far right.
    In the past I have entered the Fixed Text with a word processor, published it to a PDF file, then added the check box and date fields with the Acrobat Forms editor.  I would prefer to use FormsCentral if it is possible.

    We now support multiple fields on one line. This post provides a brief overview.
    Give it a try and send us your feedback.
    Sorry it took so long.
    Randy

  • How to change font in multiple form fields?

    I am creating a form - there are about 2 dozen form fields that are set up.
    I had Acrobat detect form fields.
    Is there a way I can select multiple form fields and change the font in all of them?
    I have tried selecting all the fields [cmd A] and double clicking to get to the appearance tab.
    The only changes the font in the 1 field I double click.
    thanks everyone!

    matthewmcneil wrote:
    I am creating a form - there are about 2 dozen form fields that are set up.
    I had Acrobat detect form fields.
    Is there a way I can select multiple form fields and change the font in all of them?
    I have tried selecting all the fields [cmd A] and double clicking to get to the appearance tab.
    The only changes the font in the 1 field I double click.
    thanks everyone!
    Select all the form fields , select first the hold shift key and select the rest Then right click or control click and choose properties. then look for "Fonts" choose desired font. If this works your all set otherwise you will have to choose each indivually and change.

  • Is there a way to rename multiple form field names with a "b" at the end?

    I have a two page form, both are identical.  I need to rename all the field names on page 2 with a "b" at the end of the file name so they dont conflict with that of the first page.  Is there any fast way of doing this without renaming each individual one at at time?  I have a LOT to do!

    It's not possible with JavaScript. The name property of a field is read-only.
    I would suggest making a template from the first page and then spawn a new page from it.
    If you do it from a script make sure you set the bRename property to true and the form fields will be automatically renamed, but you can't specify the name, it will be in following pattern:
    P<Page Number>.<Template Name>.<Original Field Name>

  • PDF form field validation - 2 criterias?

    Does anyone know how can I get a numerical pdf form field to validate within a range as well as validate that the value is equal to or less than the value of another numerical field?
    Thanks!

    I think the following custom Validate script will do what you want:
    function range_validate1() {
        // Do nothing if field is blank
        if (!event.value) {
            return;
        // Initialize some variables
        var sError = "";
        var nMin = 0;
        var nMax2 = 2e6;
        var nVal = +event.value;  // Value user entered, converted to a number
        // Get the other field value, converted to a number
        var nMax1 = +getField("Text1").value;
        // If the value is less than the minimum
        if (nVal < nMin) {
            sError = "Please enter a value greater than or equal to: " + nMin;
        // If value exceeds the other field value...
        if (nVal > nMax1) {
            sError = "Please enter a value less than or equal to: " + nMax1;
        // If value exceeds the max. possible value   
        if (nVal > nMax2) {
            sError = "Please enter a value less than or equal to: " + nMax2;
        // Alert the user and reject the value
        if (sError) {
            app.alert(sError, 0);
            event.rc = false;
    // Call the function
    range_validate1();
    The function can be placed in a document-level JavaScript, but the last line should be the custom Validate script for the field. Replace "Text1" in the line containing the getField statement to the actual name of the other field.

  • Multiple form field instances populating ES Process Mgr variables

    Hi ES Process Designers,
    I am building up a new process in which the user can add instances of one to many fields in a form. I'm trying to find a way to populate a variable(s) with the second or greater instance of a form field value.
    When using a List variable I can retrieve process_data/field[1]. It appears that the form isn't returning a list of all instances as process_data/field[2] remains empty. Possibly I don't understand how the form returns data to the process?
    Variable = Variable1, type List
    Location = /process_data/FormField
    Expression = /process_data/myForm.pdf/ ... /data/FSFIELDS_/FormField[2]
    Any assistance with this will be very much appreciated. Thanks,
    Rod

    Hi
    Try opening your form in Acrobat, and exporting the data.
    This will show you the format of your data, and should give you a clue about how to reference it using an xpath expression.
    It's also highly recommended that you design an XML schema for your form, which will allow the Xpath expression browser to see "inside" the fields in your form. Please see the Designer docs for more information.
    The official LiveCycle training courses also cover these techniques.
    Howard
    http://www.avoka.com

  • Form field validation: All required data lost when clicking browser-back-button!

    Hi folks,
    I have a big problem using the validation text  field components of Spry when the user must click the browser back button (or clicking a history.back()-Link) because he has  entered a wrong CAPTCHA-code!
    Right now, all the data - only in the required fields - not in the optional  fields!!! - is lost and the user has to enter all data once  again;-(
    Does anybody know why only the data in the  required fields is lost? Is there a nice workaround?
    I really  appreciate a quick answer:-)
    Kind regards from cloudy Germany
    Thomas

    rememberFormInputs('frmlogin', 'input-');
    'frmlogin' should be the id of page, not the name. so on your <form> tag, add the id="frmlogin"
    remove the
    // overload alert
    function alert(str) {
         var el = document.getElementById('alert');
         if (el) {
              el.value += str+"\r\n";
    Its really bad practice to overwrite the alert. and inside the rememberFormInputs remove these lines:
    alert('old value remembered: '+old_value);
    alert('setCookie: '+name + ' = '+value);
    and it should work

  • Form Field Validation

    Hi All,
    I am new to PDF forms so sorry if this is a dumb question. I have a number field which I need it to validate the number of digits it must =13 or be blank.
    Is there a simple way to do this? I have set the field max size to 13 digits but I need to stop them inputting less than 13 digits it must match 13 exactly.
    Any help would be great.
    Many Thanks
    Adam

    You can use the following code as the custom Validate script for the field:
    // Custom Validate script
    if (event.value && event.value.length !== 13) {
        // Let the user know something is wrong
        app.alert("Please enter a total of 13 digits.", 3);
        // Optionally, reject the value if only 1-12 characters
        event.rc = false;
    That last line of code will reject the entry if there are from one to twelve characters. Just leave it out if that's not what you want to do.

  • Set maximum size in Text Form Field Options for a field in bi publisher RTF

    Hi All,
    How to set maximum size in Text Form Field Options for a field in bi publisher RTF.
    I have a RTF whch is having a field in that i need to add some validation condition but after adding certain condition in Add help text tab ,it is not accepting after certain length, how i can increase the length to unlimited,please help me on this
    Thnaks

    Form fields have some restrictions if your are using version lower than 11g.
    They can accommodate only 393 chars. You can add the text in both status bar and help key, which can in total consume 393 chars.
    If your code logic is more than that, it can be split into multiple form fields as Avinash suggested or you can use sub template logic and handle coding over there. Again in sub template code can be within/outside form fields.
    So there is no option for user to increase the size of form field.

  • Editing Form Fields inside Acrobat? (after using LiveCycle Designer)

    Adobe Acrobat 9 Pro Extended ==  Acrobat
    LiveCycle Designer ES 8.2 == LiveCycle Designer
    =========================================
    Say I downloaded a new PDF from the interwebs.
    I want to add some forms fields so I go to Forms ==> Add or Edit Fields... (inside Acrobat)
    Now Acrobat will detect possible places where to add the form fields. I make changes etc. Then I am  satisfied with my form fields.
    Now say I want to remove a particular object from the PDF, lets take an image as an example.
    So I fire up  LiveCycle Designer; File ==> New ==> Import a PDF document ==>  Create an Interactive Form with a Flowable Layout.
    I remove that pesky little object.
    In LiveCycle Designer, I save the file as PDF.
    I open up Acrobat. I realize I need to make some more changes to some of the Form  Fields.
    But now instead of "Add or Edit Fields..." option I get "Edit Form in  Designer..."
    I hate the GUI of LiveCycle Designer --- I had rather edit the form  fields from inside Acrobat, as it is easy and fast to change multiple  form fields in a few clicks.

    Thank you Niall for the above response; Your response gave me an idea which allowed me to remove that line by zooming in to 200%
    You know Acrobat detects Form Fields for you.
    But many times it makes mistakes, for example in the screenshot below it made the boxes that came with the PDF as text fields instead of check boxes.
    The thing is rather than me delete the (form) fields it detected, and start over by making new check boxes, I will not be able to place my new check box in exact locations as Acrobat has done.
    When I imported the fields that Acrobat made into LC (by saving the PDF in Acrobat and then opening it with LC) I get option to change the Object Type from Text Field to Check Box when I right click the object.
    Is there a similar way to change the Object Type from Text Field to Check Box inside Acrobat? Any suggestions?
    ===========
    I would really like to do it inside Acrobat because then if I have to make some minor changes to some field properties, all my hard work which I did by filling the fields gets deleted, as I am forced to use LC. The text I add to the fields don't get deleted when I edit the field properties inside Acrobat. I don't know why LC decides to delete all the text which is filled out in the form fields even though the PDF is saved in Acrobat before being imported into LC?
    Here is the above PDF file with the text boxes:
    http://www.mediafire.com/?lnn32jm5am5
    Again thanks for all your guidance so far.

  • Using Auto Suggest To Set The Value Of Multipe Form Fields

    I would like to use the Spry 1.5 Preview Auto Suggest widget
    to provide the value for multiple form fields based on the row the
    user selects in the auto suggestion data set. I've placed an
    example of what I want to do here:
    http://www.brucephillips.name/spry/Spry_P1_5_Preview/autosuggest/autosuggestMultipleFields .cfm
    It appears that when the user clicks on one of the rows in
    the auto suggestion data set, the current row for the data set is
    not updated but remains the default (first row in the data set).
    Therefore, if you have a spry:detailregion that uses that data set,
    the values for that detail region are from the first row in the
    data set and not the row the user selected.
    Is it possible to set the current row of the auto suggest
    data set to the row the user clicked on in the auto suggestion data
    set so that the spry:detailregion will have the values from the row
    the user clicked on?
    I had previously modified the Spry 1.4 Auto Suggest widget to
    do this. See:
    http://www.brucephillips.name/blog/index.cfm/2006/11/6/Modifing-Sprys-Auto-Suggest-Widget- to-Bind-Users-Selection-to-A-Form
    Thank you for any assistance.

    Cristian: thank you for the reply. I understand your concern
    about the user changing the auto suggest field after updating the
    complimentary fields. I think that could be handled through user
    instruction. Additionally, instead of using form fields to hold the
    complimentary data I could use non-editable paragraphs.
    I hope the change is not too difficult. I think this
    modification would make the auto suggest widget even more useful.
    For example think about a product auto suggest. User starts to type
    in the name of the product, selects the full product name from the
    auto suggestions, and now the page can immediately show in a
    spry:detailregion all the product details.
    Thanks again for considering my request. I really appreciate
    all the work the Spry team is doing. I'm looking forward to the
    official release of Spry.

  • Optimize a PDF doc with form fields

    Hi All,
    I have completed a PDF with multiple form fields (about 70). It's only one 8.5 x 11 page. It is 2.2 mB large. I've tried different ways of Optimizer but it always removes the input field functionality.
    How can I decrease file size while maintaining the integrity of the form? Thank you so much in advance. PDF attached.
    Dina

    Generally, the only thing that I remove after creating a pdf file with forms that doesn't effect the fields is to remove embedded fonts. It would be best to to all of the other optimizations before creating the form fields.
    That's nice you say, but I've got the form fields already. Try reducing the size (as you have already done), then replace the page in the file with the form fields with the one whose size you have reduced. The form fields should stay. I don't know what happens to the size of the new file, let us know?

  • Field validations in HTMLB.

    Hi All,
    We have  a few issues regarding field validations in HTMLB:
    1)We have an editable cell in a tableView of the form.Field validation is done , but we are unable to set the FOCUS on this field aftert displaying the error message.we tried using PHTMLB element focusRect but it dosent works.
    2)Thers a radio button group with three radio buttons.How to make selection of a radio button mandatory , similarly how to make selection from a DDLB mandatory in the form?
    I guess using java script will be benificial as it prevents server round trips....
    Thanks in advance,
    Anubhav.

    Hi ,
    Field validations for DDLBs is done , but i didnt find accurate solution for Radio Button Group...
    1)How to check that at least one radio button is selected from the radio button group?
    2)How to set focus on DDLB after alert message?
    I tried using
    dacument.form.elementID.focus( );
    But it gives a java script error
    Function not suppoeted for the element.
    3)How to stop form from submiting after the laert message?
    I tried using
    return false();
    after the message , it works but the IE shows the message
    Done but with errors on page
    after the OnClientClick is triggered.
    and if i use
    return false;
    , the form is submited....
    Thanks,
    Anubhav.

  • Multiple field validation under one form

    I have one form and in that form i need to validate multiple inputText fields. Each inputText field has its own button for an input assistance that would later populate that particular inputText field. When i click on one of those buttons the entire page (all fields) gets validated. Does this happen because they are all under one FORM? do we have a better way of doing this and does adding inputHidden after each field fix this? im really new at this JSF. thanks.

    If you don't have any required="true" fields, then let your custom validator check which button was pressed by determining the presence of the button in the RequestParameterMap. If your search button has a client ID of for example "formId:searchButtonId", then do something like in the validator:if (FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().containsKey("formId:searchButtonId")) {
        // validate input for search.
    }You can even pass the client ID as f:attribute along the UIInput field if you want.
    The following two articles aren't strictly what you need, but it might give useful background information:
    Action dependent requireness: http://balusc.blogspot.com/2007/12/action-dependent-requireness.html
    f:attribute and validator: http://balusc.blogspot.com/2007/12/validator-for-multiple-fields.html

  • Validation of multiple empty fields in dynamic form

    Hi,
    I have created multiple fields dynamic form consisting of both mandatory & optional fields. Since the mandatory fields are validated by default, I want to validate the optional fields while submitting as PDF document dynamically and prompt me to continue or discard the submission. Also validating each & every field is not valid option as my form contains more than 200 fields.
    I have tried with the below script which I successfully used to lock the form but in validating the empty fields I have a problem. Although I populate all the fields in the form, still I receive the validation message. Can anybody help me out on this issue?
    for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {
    var oFields = xfa.layout.pageContent(nPageCount, "field");
    var nNodesLength = oFields.length;
    // Set the field property.
    for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
    if (oFields.item(nNodeCount).isNull = 1 && oFields.item(nNodeCount).length < 0){
    xfa.host.messageBox("All the form fields are not completed, Do you want to continue","Field Validation", 2, 2);
    break
    Thanks,
    Jay

    I discovered how to accomplish this using the Manage Dynamic Form Wizard and changed the "Display as" field property from "Text field" to "Text" for the fields I wanted read only.
    Now I have another problem, the properties of one of the fields (for comments) was "Text area" when I changed it to "Text" I now have this extremely long line that streches the width of the browser.
    Is there a way to get this line to wrap? This is he line I'm working with...
    <td class="form_results"><?php echo KT_escapeAttribute($row_rssubmissions['sub_comments']); ?></td>
    Dennis
    I found the answer to this problem, Günter had answered it in another post.
    http://forums.adobe.com/message/1875032#1875032
    Dennis

Maybe you are looking for