Forms Javascripts

Hi, I'm not sure if I should ask this question in this forum or use the Adobe Javascript forum.  I have a form that needs to have a javascript in it.  I have Adobe Acrobat X.  What I need it to do is this:
If a user entered a Posted Speed in the Text Field, the Check box for Prima Fascia cannot be selected.  The same goes the other way, if someone checks the Prima Fascia check box, then nothing can be entered into the Posted Speed Text Field. 
Is there a javascript that can be used for this?  Thanks for your assistance.
Connie Bretes

I would use the "Mouse Up" action for the check box and set the readonly property of the text field based on the value of the check box.
Assuming you are using a single check box field named "ChecBox 1" and text field named "Text1" your mouse up action could be:
if(this.getField(event.target.name).value != "Off") {
// check box has been selected
this.getField("Text1").readonly = false;
} else {
// check box not selected
this.getField("Text1").readonly = true;
// option to clear the field if check box not selected
this.getField("Text1").value = "";
or
if(this.getField(event.target.name).isBoxChecked(0)) {
// check box has been selected
// make RW
this.getField("Text1").readonly = false;
} else {
// check box not selected
// option to clear the field if check box not selected
this.resetForm(["Text1"]);
// make read only
this.getField("Text1").readonly = true;

Similar Messages

  • PDF Form javascript for making readonly field by using button

    Please let me know the PDF Form JavaScript for making selected fields(Text field,Drop down list,..) as read-only by using Button.

    Do you want your button to be made read only?
    One starts with Acrobat JS Reference.
    // make all fields in a form read only;
    var oField; // variable for field being processed;
    // loop through the form fields;
    for (var i = 0; i < this.numFields; i++) {
    // process each field name;
    oField = this.getField(this.getNthFieldName(i)).readonly = true;

  • PDF Form Javascript for getting User LoginName

    Please let me know PDF Form JavaScript for showing User Login Name (login id) in the Text Field (text1), when using Button (button1).

    As noted there has to be a special folder level script installed on each user's system. This script can be written to access individual properties of the identity object or only a specific property. One can also create a function to access the identity object or even create new properties.

  • No submit button in distributed form - JavaScript help

    I have creted a from in Live Cycle Designer. After distribution submit button is not visible in Acrobat and Reader. I've looked at the form JavaScript and find out this part of code which probably hide submit button in Acrobat 9:
    showAutoGenSubmitBtn = function(bShow)
        var autoGenSubmitName = "%AUTO_GEN_SUBMIT_NAME%";
        var fld = this.getField(autoGenSubmitName);
        if (fld != null)
            var b= this.dirty;
            if (bShow)
                fld.display = display.noPrint;
            else
                fld.display = display.hidden;
            this.dirty= b;
    // Hide the auto-generated submit button for Acrobat/Reader >= 9.0
    if (app.viewerVersion >= 9)
        showAutoGenSubmitBtn(false);
    else
        showAutoGenSubmitBtn(true);
    I am not familair with JavaScript so I would apprecite if someone can help me how to edit it to make submit button visible.
    Below is a complete JaveScrip of mentioned form.
    Thanks
    //@@FORMSWORKFLOW auto-generated script
    AdobePatentID="B643"
    var AdobePatentID = "AdobePatentID=\"B643\"";
    // Show a dialog to ask the user's name and email during submit.
    askUserIdentity = function(doc)
        // string constants
        var dlgStrings =
            sDlgTitle:          "Send Form",
            sEmailLabel:        "&Email Address:",
            sNameLabel:         "Full &Name:",
            sSubmitLabel:       "&Send",
            sToLabel:           "To:",
            sSubjectLabel:      "Subject:",
            sSubjectContent:    "Submitting Completed Form",
            sAttachmentLabel:   "Attachment:",
            sFromLabel:         "From:",
            sErrorEmailRequired:"Please enter a valid email address.",
            sErrorNameRequired: "Please enter your name."
        var dlgElems = [];
        dlgElems[dlgElems.length] = {
            type: "view",
            align_children: "align_left",
            elements:
                    type: "view",
                    align_children: "align_row",
                    elements:
                            type: "static_text",
                            name: dlgStrings.sToLabel,
                            width: 80,
                            bold: true,
                            font: "dialog"
                            type: "static_text",
                            item_id: "sdto",
                            width: 270,
                            font: "dialog"
                    type: "view",
                    align_children: "align_row",
                    elements:
                            type: "static_text",
                            name: dlgStrings.sSubjectLabel,
                            bold: true,
                            width: 80,
                            font: "dialog"
                            type: "static_text",
                            name: dlgStrings.sSubjectContent,
                            width: 270,
                            font: "dialog"
                    type: "view",
                    align_children: "align_row",
                    elements:
                            type: "static_text",
                            name: dlgStrings.sAttachmentLabel,
                            bold: true,
                            width: 80,
                            font: "dialog"
                            type: "static_text",
                            item_id: "atch",
                            width: 270,
                            font: "dialog"
                    type: "gap",
                    height: 5,
                    width: 350
                    type: "static_text",
                    name: dlgStrings.sFromLabel,
                    bold: true,
                    font: "dialog"
                    type: "static_text",
                    name: dlgStrings.sEmailLabel,
                    bold: true,
                    font: "dialog"
                    type: "edit_text",
                    item_id: "emal",
                    width: 250
                    type: "static_text",
                    name: dlgStrings.sNameLabel,
                    bold: true,
                    font: "dialog"
                    type: "edit_text",
                    item_id: "name",
                    width: 250
                    type: "gap",
                    height: 5,
                    width: 350
                    type: "ok_cancel",
                    ok_name: dlgStrings.sSubmitLabel
        var desc = {
            resourceContext: "AcroForm",
            description:  {
                name: dlgStrings.sDlgTitle,
                elements: [
                        type: "view",
                        align_children: "align_left",
                        elements: dlgElems
        desc.initialize = function(dialog)
            var METADATA_ANNOT_NAME = "adhocFormState";
            var PROP_INITIATOR = "initiator";
            var initiator;
            var annot = doc.getAnnot(0, METADATA_ANNOT_NAME);
            if (annot != null) {
                var arrProps = new Array();
                arrProps = annot.contents.split(";");
                initiator = getProperty(arrProps, PROP_INITIATOR);
            var decodedFileName = unescape(doc.documentFileName);
            var initVars =
                sdto: initiator,
                atch: decodedFileName
            dialog.load(initVars);
        desc.validate = function(dialog)
            var values = dialog.store();
            if (values.emal == "") {
                app.alert(dlgStrings.sErrorEmailRequired);
                return false;
            if (values.name == "") {
                app.alert(dlgStrings.sErrorNameRequired);
                return false;
            return true;
        desc.commit = function(dialog)
            this.result = new Object;
            var values = dialog.store();
            this.result.name = values.name;
            this.result.email = values.emal;
        var ret = app.execDialog(desc);
        if (ret == "ok")
            return desc.result;
        else
            return null;
    askEmailClient = function(doc)
    // string constants
        var dlgStrings =
            sDlgTitle:      "Select Email Client",
            sDlgText:       "Please indicate the option which best describes how you send mail.",
            sDesktop:       "&Desktop Email Application",
            sDesktopDesc:   "Choose this option if you currently use an email application such as Microsoft Outlook Express, Microsoft Outlook, Eudora, or Mail.",
            sInternet:      "&Internet Email",
            sInternetDesc:  "Choose this option if you currently use an Internet email service such as Yahoo or Microsoft Hotmail. You will then need to save your form and return it manually to [email protected] using your Internet email service."
        var dlgElems = [];
        dlgElems[dlgElems.length] = {
            type: "view",
            align_children: "align_left",
            alignment: "align_fill",
            elements:
                    type: "static_text",
                    name: dlgStrings.sDlgText,
                    width: 350,               
                    font: "dialog"
                    type: "radio",
                    name: dlgStrings.sDesktop,
                    item_id: "rad1",
                    group_id: "rgrp",
                    bold: true,
                    font: "dialog"
                    type: "view",
                    align_children: "align_top",
                    elements:
                            type: "gap",
                            width: 20
                            type: "static_text",
                            name: dlgStrings.sDesktopDesc,
                            wrap_name: true,
                            width: 342,
                            font: "dialog"
                    type: "radio",
                    name: dlgStrings.sInternet,
                    item_id: "rad2",
                    group_id: "rgrp",
                    bold: true,
                    font: "dialog"
                    type: "view",
                    align_children: "align_top",
                    elements:
                            type: "gap",
                            width: 20
                            type: "static_text",
                            name: dlgStrings.sInternetDesc,
                            wrap_name: true,
                            width: 342,
                            font: "dialog"
                    type: "gap",
                    height: 5,
                    width: 350
                    type: "ok_cancel",
        var desc = {
            resourceContext: "AcroForm",
            description:  {
                name: dlgStrings.sDlgTitle,
                width: 250,
                elements: [
                        type: "view",
                        align_children: "align_left",
                        elements: dlgElems
        desc.commit = function(dialog)
            this.result = new Object;
            var values = dialog.store();
            this.result.send = values.rad1;
            this.result.save = values.rad2;
        var ret = app.execDialog(desc);
        if (ret == "ok")
            return desc.result;
        else
            return null;           
    AdobePatentID="B643"
    // set a new property value to a property in the specified array.
    setProperty = function(arrProps, propName, propValue)
        var i;
        var bSet = false;
        for (i = 0; i < arrProps.length; i++) {
            var propParts = new Array();
            propParts = arrProps[i].split(":");
            if (propParts[0] == propName) {
                propParts[1] = propValue;
                arrProps[i] = propParts.join(":");
                bSet = true;
                break;
        if (!bSet)
            arrProps[arrProps.length] = propName + ":" + propValue;
    AdobePatentID="B643"
    // get the value for a property in the specified array.
    getProperty = function(arrProps, propName)
        var i;
        for (i = 0; i < arrProps.length; i++) {
            var propParts = new Array();
            propParts = arrProps[i].split(":");
            if (propParts[0] == propName) {
                return propParts[1];
        return null;
    AdobePatentID="B643"
    showAutoGenSubmitBtn = function(bShow)
        var autoGenSubmitName = "%AUTO_GEN_SUBMIT_NAME%";
        var fld = this.getField(autoGenSubmitName);
        if (fld != null)
            var b= this.dirty;
            if (bShow)
                fld.display = display.noPrint;
            else
                fld.display = display.hidden;
            this.dirty= b;
    // Hide the auto-generated submit button for Acrobat/Reader >= 9.0
    if (app.viewerVersion >= 9)
        showAutoGenSubmitBtn(false);
    else
        showAutoGenSubmitBtn(true);

    I'm distributing the form in Acrobat Pro 9.
    I created the form in Live Cycle Designer.  Save, then open in Acrobat pro.  Extend Features to Acrobat Reader, click the drop down box on Forms and hit distribute.  I save a local copy.  When I open the distributed form the buttons do fall silent, the Submit Button on the purple line up top still works, but that doesn't appear in reader and the people who will be completing the form all use reader.  Any suggestions for a fix?
    I'd like to distribute because that automates the tracking.  It works undistributed.

  • Using the Form javascript.addrow() to pass values while creating a new row?

    Version: 4.1.0
    DB: 11g
    Theme- scarlet 21
    Hi,
    I have a standard tabular form with the add, delete, submit buttons. Now when we hit the Add button, it creates a new row in the form. I had a requirement such that the user selects a row using the standard checkbox and then when he hits add, it should create a new row, and also, copy the contents of the selected row to the new row.
    Is this possible? Any suggestions please? I am thinking that I need to create a pl/sql process under Add button to check if the checkbox is selected, and if yes, then maybe run the javascript addrow(not sure if it can be done) and then try to populate the values.
    Thanks!
    Sun
    Edited by: ryansun on Oct 4, 2012 12:34 AM
    Edited by: ryansun on Oct 4, 2012 12:46 AM
    Edited by: ryansun on Oct 4, 2012 12:46 AM

    Hi Joni,
    Thanks. I am not familiar with JQuery, is there some link where such a logic is implemented? Atleast a basic one of adding a new row, and traversing and capturing the values? In forms we could do it using cursor but not sure how to do it in Apex.
    In my case the requirement is straightforward. If there is a table with three rows and have a standard form in APEX with the add, delete and submit buttons along with the radio checkbox in a tabular form,
    If I select a row and then hit the add button, a new row should be added and the values of the previous row should be passed.
    Would you be having a link to any such demo or documentation on how this is done, would be very helpful.
    Thanks!
    Sun

  • ReadOnly columns on Tabular Forms (Javascript?)

    I have a question in regaurds to tabular forms. I have a tabular form set up, working perfectly. However, I want to be able to make certain columns readonly upon adding the new row (clicking new row button).
    Scenario:
    1) Go to tabular form
    2) Click add row
    3) Once the new row apppears, the columns should all be read only columns (i.e. cant type in them)
    4) Exception: There is one column, a select list, that shouldn't be readonly.
    5) Depending on which value is selected from the select list, determines which columns will be editable, or un-read-only.
    - The last step is merely a conditional. The part that is plaguing me is accessing the actual columns of the tabular form. I'm not too sure how to go about this. Would I even have to make changes to the actual AddRow() function itsself?
    Thanks for any help in advance
    sincerely, #StillLearningApexGuy

    wOW,..this example works perfectly. My javascript/jquery is a little rusty but I should be able to tweak the example for my needs.
    Thanks for the example. I am in your debt
    Sincerely #GreatfulApexGuy

  • Help required in Adobe Forms Javascript code

    Hi Experts,
    Please assist in the javascript coding part of Adobe Forms in SAP.
    Requirement - Filter the values of second dropdown list based on the selected value in first dropdown list.
    Say for Example - First dropdown list has Company Code values. If we select a company code in first dropdown list, then the corresponding Plant based on selected company code should display on second dropdown list.
    Thanks in Advance.
    Sunil

    Dear Sunitha,
    Thanks for your reply.
    Can you please specify how to create a virtual table and Associated dataset in Adobe Forms.
    Our scenario is to create a Sales Order in SAP via Adobe Forms through Offline.
    Please find the below image.
    Data for Company Code and Plant is available in 2 Internal Table.
    Please assist in the following
    How to combine these 2 Internal tables inside Adobe Forms.
    Filter the values of Plant based on Company Code.

  • Acrobat Forms - javascript to hide/unhide text box if any one of a number of radio buttons is enable

    I have a form which I am designing in Acrobat 9 which has a section where there are three questions, each with a pair of radio buttons - one for 'yes' and one for 'no'. They are in the style of a check box (with a tick). I need some help to write some code which will unhide a single field (or multiple fields if I need to use something similar at a later date) if any one of the 'yes' radio buttons is checked. So if all three radio buttons were checked, the field would be hidden but if you then changed your mind and clicked a yes button, the field would be visible.
    I am new to this so any help would be greatly appreciated. Many thanks in advance! I hope that i have explained this clearly btw.

    For ease of maintenance you might want to make the above script into 2 doucment level JavaScript function. One could set a return value to the result of the caparison and the other could show/hide the text field based on the result. Then a call to the show/hide function could control the show and display of the field(s) and and a call to the function for the results of the comparison could be used anywhere else and not change the field display property.
    funciton Test3RB() {
    // set logical result based on result of test
    var bReslut = ((this.getField("rb1").value == "Y")|(this.getField("rb2").value == "Y") |(this.getField("rb3").value == "Y"));
    return bResult; // return value of logical test
    } // end funciton
    function ShowText() {
    // assume field not to be shown
    this.getField("textbox").display=display.hidden;
    if (Test3RB() ) {
    this.getField("textbox").display=display.visible;
    } // end if true
    return;
    } // end ShowText function
    You mouse up action for each button could be:
    ShowText();
    And if you could test the logical value returned by the function somewhere else and did not want to modify the display field:
    if(Test3RB() ){
    // action for true
    } else {
    // action for false

  • Adobe form javascript error

    hi experts,
    i am new to adobe interactive forms. i have created a simple form with some input fields which refer to abap webdynpro context and added a submit button from webdynpro activex menu. the click event is created in abap web dynpro. when i execute the webdynpro application i am seeing the form, but at the top i see the following message
    "javascript is currently disabled and this dcoument uses it for some features. enabling javascript can lead to potential security issues"
    at the right side of the error there is a button "options" . when i click that and selected "enable javascript for this document" . but the error still reamins. when i select the option for the second time i get a user session time out error in the browser.i am using windows 7. pelase suggest what settings i need to make?
    thanks

    hi,
    i am using ZCI and webdynpro native submit button now. i have also placed the script code which was given by u in some other discussion
                     // DO NOT MODIFY THE CODE BEYOND THIS POINT - 705.20051114114126.253659.250577 - SubmitToSAP.xfo
                          ContainerFoundation_JS.SendMessageToContainer(event.target, "submit", "", "", "", "");
                          // END OF DO NOT MODIFY
    but still it is not working. we are using adobe live cycle 7.1 and our ECC version is 7.01 level 006. i will try in a windows XP machine

  • Disable a Form Javascript in Acro 7 Professional

    Hi all,
    I have a form with some alerts that appear when you open the form (with messages like: "you need to have the latest adobe reader" and things like that).
    I have a server arquitecture in which I open the pdf with an Acro 7 professional, of course every time that I open the pdfs the messages are shown.
    My question is, anybody knows how can I disable the javascript execution in Acro 7 Professional?
    I have found a way to do that in Edition, Preferences, Javascript, Disable javascript. But that option seems to be not working when you create the form with Designer!
    Thanks in Advance.

    try it without the quotes maybe?
    document.forms[0].textBoxPropertyName.disabled=true;Without seeing the html generated for the page, it is impossible to say if your javascript is right or not.
    What about it doesn't work?
    Do you get a javascript error?
    Does it disable the field, and the error is later?
    One thing you do need to be aware of, if you disable a field on the page, it will not submit a value with the form. That can sometimes trip people up.
    cheers,
    evnafets

  • Struts Mapped-Backed Form & Javascript

    Hi I have a form like this:
        <html:form action="AlAction.do" styleId="form"
              onsubmit="return verify()">
         <input type="hidden" name="value(mca_action)" value="AccessLocationAddSubmit">
         <table border="1" id="accesslocation">
             <tr>
              <td>Roaming Group Name</td>
              <td><html:text property="value(alName)" styleId="alName" onkeypress="return onKeyPressBlockNumbers(event);"/></td>
             </tr>
             <tr>
              <td>IP Address</td>
              <td>IP Mask</td>
              <td>Type</td>
              <td><input type="button" value="Add" onclick="addRow('accesslocation');"/></td>
             </tr>
             <tr>
              <td><html:text property="value(alIpAddress)"/></td>
              <td><html:text property="value(alIpMask)"/></td>
              <td>
                  <html:select property="value(alType)">
                   <html:option value="sgsn">SGSN</html:option>
                   <html:option value="coa">COA</html:option>
                  </html:select>
              </td>
             </tr>
         </table>
         <BR>
         <input type="submit" name="Submit" value="Submit">
         <input type="reset" name="Reset" value="Reset">
        </html:form>The field "value(alName)" is a required field but i'm having trouble accessing it in my javascript:
    document.form.element['value(alName)']==""
    Is that the right way to access the fields?

    Give proper name to html fields.
    remove brackets from the name.
    If u want any separater then better give underscore.
    hope this will solve ur issue

  • Forms behavior when closing browser or forms, javascript

    Hi
    I want to be able to run Jinitiator in separate frame, but with the possibilities to close the browser when closing the forms and in on the same html page I would like to have the possibilities to fire a message if the end user try to close the web browser directly (not by closing the forms).
    I find in the forum solutions for the two constraints but if I try to put this two behavior together: message fire even when I close the forms because the post-form trigger try to close the browser. I try to put condition on the alert with a variable but do not succeed. how could I manage to setup the two behaviour together?
    Is it possible to put condition in javascript to see if the end-user close the browser via forms or via the browser?
    thanks

    I've installed the FormsStart utility...and it looks great.
    However, if I have separateFrame=true, when my forms application starts, it opens 2 applet windows.
    If I have separateFrame=false, everything looks ok except that when I alt-tab to a different application and return - my focus is not returned to the field that the cursor was in.
    Is this something inherent with having separateFrame=false? Is there a way around it?
    Cheers,
    Dave

  • PDF Forms JavaScript Help

    Hello,
    I've learned the hard way that JavaScript in forms may not work on tablets (across various OS). I have two custom calculation scripts running in my form, and was wondering if there's another way to write them, or a work around, to where it would work on tablets (I'm no JavaScript expert!)?
    I have one calculation that counts the number of check boxes in a list (check boxes 20-31) that are checked:
    var total = 0;
    for (var i=20; i<=31; i++) {
    if (this.getField("Check Box"+i).value!="Off") total++;
    event.value = total;
    From that, I have another calculation that returns a value in another field based on the number of check boxes checked:
    var a = this.getField("Check Box Count").valueAsString;
    event.value = "";
    if (a=="1") event.value = "0.00";
    if (a=="2") event.value = "300.00";
    if (a=="3") event.value = "300.00";
    if (a=="4") event.value = "300.00";
    if (a=="5") event.value = "300.00";
    if (a=="6") event.value = "300.00";
    if (a=="7") event.value = "300.00";
    if (a=="8") event.value = "300.00";
    if (a=="9") event.value = "300.00";
    if (a=="10") event.value = "300.00";
    if (a=="11") event.value = "300.00";
    if (a=="12") event.value = "300.00";
    I don't know which of the two, or both, is the issue. Is there a work around I could use?
    Many many thanks in advance for any help!!

    Do you mean update the full script to the below? I tried that and unfortunately it didn't work. Am I missing a command somewhere?
    Thanks!
    var a = this.getField("Check Box Count");
    event.value = "";
    if (a==1) event.value = "0.00";
    if (a==2) event.value = "300.00";
    if (a==3) event.value = "300.00";
    if (a==4) event.value = "300.00";
    if (a==5) event.value = "300.00";
    if (a==6) event.value = "300.00";
    if (a==7) event.value = "300.00";
    if (a==8) event.value = "300.00";
    if (a==9) event.value = "300.00";
    if (a==10) event.value = "300.00";
    if (a==11) event.value = "300.00";
    if (a==12) event.value = "300.00";

  • Forms && JavaScript on Pocket PC 2.0

    I have an application developed in Acrobat. Heavy use of forms and JavaScript. From what I've read, the forms should work in Acrobat Reader Pocket PC Version 2.0. Will the JavaScript work, too? TIA

    Supongo que desde la PDA no has podido desinstalarlo, descargate este porgrama "SpbPocketPlus3" es gratuito e intenta quitar el programa con el desinstalador que trae.

  • Email Interactive form - javascript-outlook

    Hi,
    I am sending an Interactive form via e-mail and I have used follow javascript .
    When my outlook is not opened at all it throws me an error(Operation failed) .I want to send it regardless whether outlook opened/closed.
    when it is opened it works fine.
    var lEmail = xfa.record.ITEM.PEMAI.value;
    var CEmail = xfa.record.ITEM.PPCC1.value+";"+xfa.record.ITEM.PPCC2.value+
    ";"+xfa.record.ITEM.PPCC3.value+";"+xfa.record.ITEM.PPCC4.value+";"
    +xfa.record.ITEM.PPCC5.value;
    var myDoc = event.target;
    try {
      myDoc.mailDoc({
        bUI: false,
        cTo: lEmail,
        cCc: CEmail,
        cSubject: "Document",
        cMsg: "Dear Customer,.........."
    } catch (e) {}
    -Also when I don't type in all Ccc mails which I have used it doesn't send mail .I mean Of I type in only 2 Cc mailss.. it doesn't send the mail.
    How to take care of this ?
    Rgds
    Vara
    Edited by: Vara K on May 15, 2009 4:31 PM

    hi
    good
    go through these links, i hope these ll help you to solve your problem.
    https://media.sdn.sap.com/javadocs/NW04/SPS15/wd/com/sap/tc/webdynpro/services/sal/config/api/WDConfigurationConstants.html
    https://media.sdn.sap.com/javadocs/NW04s/SPS7/wd/com/sap/tc/webdynpro/clientserver/uielib/adobe/api/WDInteractiveFormDisplayType.html
    thanks
    mrutyun^

Maybe you are looking for