How to validate required fields before executing menu item ("Save As") using cutom Javascript?

Hi,
Sorry, I am new to PDF Development. I tried creating PDF using Acrobat XI Pro. During creation, I have encountered issues in running custom JavaScript. The requirement is to validate all the required fields before saving the PDF. I tried using the following scripts to validate the said required fields. But, it's not working.
Option 1: If the field is null, a message box will appear.
if(this.getfield("textbox") = null){
app.alert("required");
else {app.execMenuItem("SaveAs");}
Option 2: If the field is required, a message box will appear.
var f = this.getField("textbox");
f.required = true;
if(f = true)
app.alert('required');
else
app.execMenuItem("SaveAs");
The scripts mentioned above are not working. I wanted to validate the required fields before saving the PDF.
In addition, I tried validating each field using the following script:
f = getField(event.target.name)
if (f.value.length == 0)
    f.setFocus()
    //Optional Message - Comment out the next line to remove
    app.alert("This field is required. Please enter a value.")
When I open the PDF, the script is working. However, when the message box pops out, the "OK" button is not working as expected. The message box is not closing. I tried opening the form in a site in different Java versions (like 7-11 and 7-67). It's working in version 7-67. I tried upgrading the Java version from 7-11 to 7-67. Still, it doesn't work.
I would appreciate your feedback on this matter.

If you set the fields as required, then when the user hits the print button you could run this script:
var txt = form1.execValidate();
if (txt == true){
print command
This code assumes that the root node of your form is form1. Also ensure you put a message into the Empty Message parameter for each field that you want to mark s required.

Similar Messages

  • How to validate a Query without executing it?

    How to validate a Query without executing it?
    For example if I have:
    ReadAllQuery myQuery = new ReadAllQuery(myClass);
    myQuery.setSelectionCriteria(myExpression);
    What can I do to have must validation as possible been done before executing the query?
    Validation that could be done are:
    - Expression reference fields that really exist in TopLink mapping
    - Literal provided to expression are of compatible type
    - Parameter setting set against the query are all compatible

    Your could prepare the query.
    query.prepareCall(session, record);
    This will do all query validation and generate the SQL for the query.

  • How to validate the fields  and how to display the error messagein presenta

    Hi,
    I am new to OBPM 10g, pls tell me how to validate the fields in a presentation.
    for example if we take login presentation if user enters his user name and password wrongle and submit the form. Then we need to display error message right side of the each field i.e user name and passowrd is wrong and try again.
    Regards
    jaya
    Edited by: 12345 on Aug 12, 2010 10:38 PM

    Hi Jaya,
    You can initially set the validation for empty values.. that is when the user dint enters any value and clicks on submit.
    for these vadliations you need to write a method and call it on submit button click!!
    secondly, you can validate for the format if required.
    thirdly, you can validate against a database for the credentials. For this you need to fetch list of usernames from database and search for user entered value in that list.
    Optimal query would be : if user name not null, query for pwd of the entered user name from database or file storage. if you dont get any value for pwd of given username, its incorrect user name. if you get some pwd value for username, then check against the one user entered in pwd field..
    Write all this logic in a method and call on submit button click event of the login form!!
    HTH
    Sharma

  • How to validate ch field in selection screen

    hi experts.......
    how to validate ch field selection screen......... and which function module is used to validate parameter field i.e character

    Hello,
                Is your requirement to Validate the Character Field? This is what I understand. If it is right, then do you want to Validate whether a Character Value is entered?
                Check the below Sample Code.
    At Selection-Screen on P_CHARFIELD.
        IF P_CHARFIELD CA '1234567890'.
            Message 'Enter an Alpha Character only' Type 'E'.
        Endif.
    Thanks and Regards,
    Venkat Phani Prasad Konduri

  • How to validate the field when i am populating the data cursor to block

    Hi,
    I am populating data cursor to multi record block.
    Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
    If user enter negative values and decimal points in quantity filed i need to display message to user item level.
    Please do the needful how to do it.

    902434 wrote:
    Hi,
    I am populating data cursor to multi record block.
    Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
    If user enter negative values and decimal points in quantity filed i need to display message to user item level.
    Please do the needful how to do it.If you want to validate at entry level then use When-Validate-Item trigger and check the input and show message. Like
    If :quentity <0 then
    message('do not enter negative value');
    message('do not enter negative value');
    raise form_trigger_failure;
    end if;Why u open same thread again ? not closing one.. check this one
    </a>
    How to validate the field when i am populating the data cursor to block
    Hopes this helps
    If someone's response is helpful or correct, please mark it accordingly.

  • How to validate input fields as the user is filling up a form with jQuery?

    Hello EA friends.
    Someone has experimented on how to validate input fields as the user is filling up a form with jQuery?, if the field is numeric and insert an A for example, an alert appears showing "insert a number" or not allowed to enter anything until a number is entered.
    Thanks and regards.
    Fer

    Hi Sudeshna.
    Sorry for not responding on time, how can I be included in this code?
    sym.setVariable("typeActivity", "input")
    var Element_1=document.createElement(typeActivity);
    $(Element_1).css({"text-align": "center"});
    //Answer
    sym.setVariable("Answer_1", "4");
    sym.$("box_1").append(Element_1)
    This code is on my creationComplete and it works fine.
    Would greatly appreciate your help.
    Regards.
    Fer García

  • How to make required field on selection screen in Query

    i'm now working with query(SQ01).
    but don't know how to make required field on selection screen in Query.
    thanks in advance

    i'm now working with query(SQ01).
    but don't know how to make required field on selection screen in Query.
    thanks in advance

  • How to create required field in alv?

    hi friends^^
    how to create required field in alv?
    i don't find required option in fieldcatalog and others.
    is it possible?

    Source code..
    PLANETYPE is key_sel = 'X'.
    But does't required field...
    REPORT  zs32editable1  .
    TYPE-POOLS : slis.
    DATA : gt_sflight  TYPE TABLE OF sflight.
    DATA : gt_fieldcat TYPE slis_t_fieldcat_alv,
           gs_fieldcat LIKE LINE OF gt_fieldcat,
           gs_layout   TYPE slis_layout_alv.
    START-OF-SELECTION.
      SELECT *
        INTO CORRESPONDING FIELDS OF TABLE gt_sflight
        FROM sflight.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-edit = 'X'.
      gs_fieldcat-fieldname = 'PLANETYPE'.
      gs_fieldcat-key_sel = 'X'.
      append gs_fieldcat to gt_fieldcat.
    END-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_STRUCTURE_NAME = 'SFLIGHT'
          is_layout        = gs_layout
          IT_FIELDCAT      = gt_fieldcat
        TABLES
          t_outtab         = gt_sflight
        EXCEPTIONS
          program_error    = 1
          OTHERS           = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

  • How to display Tcodes infront of each menu item on bw screen ?

    Hi,  Can you please tell me the way how to display Tcodes infront of each menu item on bw screen.
    Like modelling Rsa1
    I know this is possible as i have seen it myself and i tried a lot to find. Plz help.
    Prashant singhal

    Hi,
    In Bottom of your screen tab, click small icon and choose "Transaction".
    you can see all transaction codes while you navigate to any screen.
    hope it helps
    Regards,
    Arun.M.D

  • Actobat 9 Execute Menu Item problem

    I have a new PC with Window 7 and have successfully loaded Acrobat 9 pro - but a lot of the Acrobat functionality is now missing (it all worked under the XP platform). For example, when creating a form, using a buttom with an 'Execute menu item' command is not possible - it's blank actually. As this is the most useful tool within Acrobat forms it's really annoying. I have upgraded to 9.4.1 which is supposed to be Window 7 compatible but no luck. I've unistalled and reinstalled and called Adobe support (4 hours!) and still no solution.
    Can anyone help me?

    After selecting this action you're supposed to go to the actual menus and
    select the menu item that should be executed. This is instead of choosing it
    from a list. Did you try that?

  • Check for required fields before locking subforms and submitting

    Hello,
    I have a 5-page form with many questions, to be completed by the original requestor and multiple approvers.  What I'm trying to do is have the original requestor's Submit button on p. 3 lock the input on the first three pages, but first check if all those fields have some content.  I currently have all the fields on pp. 1-3 set to "Required" in the object properties, but my script still locks them when there's is one empty one.  Here's what I have:
    //Lock portions of form
    Page1.access = "readOnly"
    Page2.access = "readOnly"
    Page3.access = "readOnly"
    //Save document, allow user to change name
    app.execMenuItem("SaveAs");
    //Submit via e-mail
    Submit_REAL.event__click.submit.target = "mailto:[email protected]" +
    "?subject=Subject text" +
    "&body=Message";
    Submit_REAL.execEvent("click");
    The automatic check for required fields happens after the pages get locked.  I would like the check to stop the process before it locks the pages.  Is there any way to check all at once that all "Required" fields on those pages have some content before allowing the script to proceed?  I know how to script it to manually check the 50 or so questions on those pages, but I would like to avoid that.  Thanks for any help.

    There are a few problems that I can see from the start. First, your code is going to pick up EVERY node that exists on these pages. Some of those nodes will not have a rawValue, and some will not have an actual name. As an example, you can take your code and create a text field to dump all of the names of the nodes that you get when you pull in all of the nodes this way. Here's an example:
    The result:
    Now, the question is, do you have a consistent naming convention for your fields that might be empty? That could be text fields, radio button lists, etc. For instance, I always prefix the names of objects in order to more easily keep track of what they are in scripts. Since I'm doing that, I can check the name of the field for tf, nf, rbl, cb, or whatever I have included to make sure that I'm checking an actual field before I check for things like rawValue.
    var nodeName = oNodes.item(nNodeCount).name;
    if (nodeName.indexOf("tf")>-1 || nodeName.indexOf("rbl") > -1 || /*check other field types*/) {
      //insert your code to check for empty answers here
    As for your line 7 issue. The syntax problem is that you've put extra parentheses in your if statement. Take out the parentheses that are just before and after the or "||".
    *This is my fourth attempt to reply. Something was going on with Adobe/Jive earlier, I suppose.

  • Require Fields Before Printing

    I've been looking through the documentation of Adobe Live Cycle Designer and cannot find my answer. I have two fields, which I would like to be required. Upon a user pressing the print button, if these fields are empty, require it before the form will print.
    I have looked everywhere and can't find my answer. I'm assuming the form will still print if the fields are blank if the user were to use the File>Print option through their specified browser?
    Any help would be appreciated.

    i found a super cool secret code to validate the whole form in one line of code!
    F.execValidate();
    so my print button is a normal button (not a print button)
    with this code for onclick:
    if(F.execValidate())
    xfa.host.print(1, "0", (xfa.host.numPages - 1).toString(), 0, 1, 0, 0, 0);
    easy as that!
    IMPORTANT:
    - unfortunatly it does not check if required fields are empty
    - it only checks the "validation pattern" under Object > Value
    - the "Error" box beside "validation pattern message" MUST be checked (if it is not checked, your validation errors will still popup, but the function will return true when it should be false - and therefore the print box will popup)

  • Validate SQL string before executing

    I am attempting to find a way to validate an SQL script file before executing against a database. This is to allow any errors within the script to be identified and fixed before running against a pre-live / live database.
    These scripts may contain both DDL and DML.
    Is there any way to run the script and only have the changes visible to the current user, with all other database users unaffected until the changes have been checked (in a similar way to running an insert / update / delete without committing the changes)? Failing this, are there any tools to check the validity of the statements within an SQL script file?
    Any help with these or alternative solutions would be much appreciated.
    Cheers,
    Steve

    This is not sensible.
    How can you test a DML that creates a table (that does not create the physical table) and then test a DDL that uses that table that was not created and of which no record exist?
    The validity of a SQL statement (DML or DDL) depends on numerous factors, including the state of the database at that specific point in time that it is being run. You may test/check a DML that creates an index and it is fine.. until run on production where it times out as it cannot get a lock on the table in order to create the index.
    Or there is insufficient free space in the tablespace to build the index. Or the index is build in parallel and one of the PQs fail because on an Oracle bug, resulting in the complete DDL failing.
    Etc. Etc.
    If the intention is to be able to test an upgrade/patch/install script for a production database for every single potential problem and error, and then have a 100% guaranteed success rate in running that on production.. er.. excuse me for a moment..
    <mad laughter heard from outside>
    Er.. okay. Back again.
    This will need - no compromises and just for starters - the exact same h/w platform, o/s, Oracle s/w, and duplicated production database (cloned perhaps) as the test platform.
    And if this is not possible or feasible then you should forget about having that script tested in such a fashion in order to have a 100% guarantee of a successful production deployment... and investigate the optimum method to test as far as possible, and build a comprehensive plan for change management and dealing with problems out of this upgrade, on production.

  • How to validate Quantity field in TV - Inputfield ?

    Hello All,
            I'm using a table view to show the output .
    IN this table view I made 2 fields as Input fields.
    Both the fields are Quantity fields.
    Now when the user enters a value in this Quantity field I want to validate it with respect to it's units .
    How can I do that ?
    In my case if the user enters correct value it works but when he enters a wrong value my BSP is going for a dump.
    I tried to debug the<b> LIPS table</b> to verify how SAP was handling this checking for the field <b>LFIMG</b>. But there there is a statement called chain --endchain.
    SO there is no chance for debugging.
    My code is as follows :-
            LOOP AT gt_final INTO wa_final.
              CLEAR: gv_row,lv_qty,lv_string,gv_len,gv_cell_id1.
              gv_row = sy-tabix.
              gv_len = STRLEN( gv_row ).
              gv_len = gv_len - 1.
    * Modify the Third Column
              CONCATENATE 'INB01_TV_ID' '_' gv_row(gv_len) '_' '3' INTO gv_cell_id1 .
              lv_string = request->get_form_field( name = gv_cell_id1 ).
              WRITE lv_string TO lv_qty  UNIT wa_final-units.
              CLEAR :wa_final-del_quantity.
              wa_final-del_quantity = lv_qty.
              MODIFY gt_final FROM wa_final TRANSPORTING del_quantity.
            ENDLOOP.
    Can anyone tell me how to validate the entry for the Quantity filed ?
    Regards,
    Deepu.K
    I have one more Question .
    Whenever BSP goes for a dump in this case I want to handle this by a message .
    Is it possible ?
    Message was edited by:
            deepu k

    Hello Raja,
           I want to validate the entry in the QUantity field with respect to the Unit of the Quantity.
    I.e say for example I have a unit as PC (pieces) then the quantity must be only of thousands,lakks and so..on......but not in points i.e a piece quantity must be full either 200 ,2 lakhs or 2 pieces but not 2.5 pieces.
    SO now if the user enters 2.5 it's a wrong value as the quantity for the Unit PIECES can't have half-piece. (2.5 = 2 + 0.5) .SO i want to validate this .
    I hope I'm clear.
    How should I do ?
    Regards,
    Deepu.k

  • How to validate a field of type text for similar values

    Hi,
    My requirement is to validate a field <b>Name1</b> of type Text[40] for similar values when a new record is created. So If the Name1 already exist in repository, the validation has to give warning message saying the customer with Name1 already exist.
    Regards,
    Madhu

    Hi Madhu
    To validate a particular field, when a new record comes along with the same value SAP MDM is not capable of generating warning messages, but we can have best method of Tracking at Import manager level.
    In the Import manager after successful mapping, access the MATCH RECORD tab. Go to the Default import action area there you can find Match type & Default import action. For example if you are sending same Material record which is already available in the Repository, Match type will have the value “EXACT” where as Default Import action will have “UPDATE (ALL MAPPED FIELDS or NULL FIELDS)”.
    Here I have copied various Match types as well as Default Import Actions along with the definitions, pls go thru the same and feel free to revert to me for further clarifications.
    <u><b>Default Import Action</b></u>
    <b>Skip -></b> Skip source value combinations that already
            exist.
    <b>Update(NULL Qualifiers Only) -></b>     Update just the NULL remaining qualifiers of each existing qualified lookup value.
    <b>Update (All Mapped Qualifiers)-></b> Update all the remaining qualifiers of each existing
    qualified lookup value.
    <b>Replace -></b> Replace all the remaining qualifiers of each existing qualified lookup value by first deleting them and then creating a new value combination.
    <b>Delete -></b> Delete this qualified lookup value during import Processing.
    <u><b>Match Type</b></u>
    <b>None -></b> None
    <b>Exact -> </b> Whether the match type for the destination record with the current source
    record is Exact.
    <b>Partial -></b> Whether the match type for the destination record with the current source
    record is Partial.
    <b>Conflict -></b> Whether the match type for the destination record with the current source
    record is Conflict.
    Thanks
    Alexander
    Message was edited by: Alexander Raja

Maybe you are looking for