Java Scripting Conditional fields

I am trying to enter a Java Script for a set of yes/no radio buttons, where if you enter yes it will require you to enter text in a nearby numeric field.  The script i'm using seems to work, but once the user enters yes just one time, it will not let them change their answer back to no without getting the error message saying that they need to enter text in the other field.  Can anyone help me with what I'm doign wrong?  Here is the script I'm using.
'2' is the value for yes and comappNUM1 and commappFC1 are the field names I want to be required if yes is chosen.  I'm guessing something needs to tell it to disable if no is selected.
if(this.rawValue =='2')
comappNUM1.mandatory = "error";
comappFC1.mandatory = "error";
else{

You have to use the script in the Change-Event from the RadioButtonList!
The ' ' is wrong.
//if (this.rawValue == "2") you can also use "2"
if (this.rawValue == 2)
comappNUM1.mandatory = "error";
comappFC1.mandatory = "error";
}else
comappNUM1.mandatory = "disabled";
comappFC1.mandatory = "disabled";
I hope this is helpfull,
Mandy

Similar Messages

  • Java Scripting

    How to add java Script Form field acrobat with 3D Annotation in plugin?

    Sorry but your question makes no sense whatsoever.

  • Using a multiple word choice in a dropdown field to fire a java script

    I'm a complete beginner to java script, and relatively new to form building in Acrobat.
    I'm using a dropdown field to auto-fill other fields based on my 1st dropdown selection.
    The 1st dropdown field allows me to select a variety of vendors.  Once I select the vendor, it auto-fills the contact info for that vendor.
    I plagiarized the scripting from this link: https://acrobatusers.com/tutorials/change_another_field.  I even changed my field names for the time being.  I'll change my form field names back and the script to match once I have it working the way I want.
    If I use a single name in my vendor dropdown (1st field), the script works perfectly and auto-fills the contact information as expected.  However, many of my vendors are two or more words...and I need these full names to print out, so I cant just make a one word contraction.  Here's the script as I'm using it:
    Here's an example of a single word vendor name that works as expected:
    // Place all prepopulation data into a single data structure
    var DeptData = { ADLEMI:{ contact: "P.O. BOX 2371",
                                  email: "DOWNEY, CA  90242",
                                  deptnum: "PHONE: (562) 923-0333  FAX: (562) 923-8111" }};
    function SetFieldValues(cDeptName)
      this.getField("DeptContact").value = DeptData[cDeptName].contact;
      this.getField("DeptEmail").value = DeptData[cDeptName].email;
      this.getField("DeptNumber").value = DeptData[cDeptName].deptnum;
    The single vendor name I used in the example above is 'ADLEMI.'  If I add 'BEST' to ADLEMI (see below) I receive a syntax error.  I really need to be able to use multiple words in my Vendor dropdown to trigger the auto-fill.
    // Place all prepopulation data into a single data structure
    var DeptData = { ADLEMI BEST:{ contact: "P.O. BOX 2371",
                                  email: "DOWNEY, CA  90242",
                                  deptnum: "PHONE: (562) 923-0333  FAX: (562) 923-8111" }};
    function SetFieldValues(cDeptName)
      this.getField("DeptContact").value = DeptData[cDeptName].contact;
      this.getField("DeptEmail").value = DeptData[cDeptName].email;
      this.getField("DeptNumber").value = DeptData[cDeptName].deptnum;
    The only difference is I added a space and the word 'BEST' after ADLEMI.  Is there a way around this.  I need to have multiple words in my dropdown, or at least the full name of the vendor showing in the field when I print it out.
    Thanks

    Place double-quotes around the item name.
    On Mon, Apr 13, 2015 at 5:29 PM, bpwhistler <[email protected]>

  • Condition verification in java script on Adobe form.

    Hello Experts,
    I am using a interactive forma text element on my view. (java web dynpro)
    It's a simple application. I am trying to figure out how it works with java script.
    I have a text field. which displays employ is sales or production dept
    the values in the data view and its the output element of a BAPI which returns XF,TF,HF and XK,JK,HK
    (record.dept)
    if its XF, TF, HF on the text field in the adobe form should print sales else production.
    I have never used java script on adobe form.
    I figured the strip above the form in adobe designer is used for java script.
    can any one, let me know how I can manipulate.  the record value
    Here is what I am trying record.dept = XF |TF|JF . but i dont know how to run the java script or its syntax.
    Your help is highly appreciated.

    James,
    xfa.host.messageBox should show you an alert dialog box to check data you are getting.
    And yes you are right. You can set the value of textfield using code you mentioned.
    if(record.dept.equalsIgnoreCase("XF")
                 || record.dept.equalsIgnoreCase("TF")
                          record.dept.equalsIgnoreCase("JF"))
       xfa.host.messageBox("The value is Sales");
       <Text-field id>.value = "Sales";
    else
       xfa.host.messageBox("The value is Production");
      <Text-field id>.value = "Production";
    You can even set the texfields to be readOnly, hide some of them etc. But for that I would suggest you going thru the LiveDesigner help. It would solve most of your doubts :-).
    Chintan
    Edited by: Chintan Virani on Feb 19, 2008 3:37 PM

  • Adobe forms-checking that required fields are completed-Java Script

    I have inserted two Java Scripts into my form--one for checking for required fields are completed, and then one for generating an email pulling a custom subject line, as shown below:
    var emptyFields = [];
    for (var i=0; i<this.numFields; i++) {
         var f= this.getField(this.getNthFieldName(i));
         if (f.type!="button" && f.required && f.display==display.visible) {
              if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off")) emptyFields.push(f.name);
    if (emptyFields.length>0) {
         app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n"));
    this.mailDoc({bUI:false,cTo:"[email protected],[email protected],[email protected]",cSubject:"Bugzilla Form for: "+this.getField("Bugzilla Title").value+" - "+this.getField("Bugzilla ID").value})
    Issue: After the error window displays fields that have not been completed, when I click OK the email window displays.
    QUESTION: How can I stop the email window from displaying until all fields are completed?
    THANKS!

    Thank you so much for your quick response (and thank you for all the code that I am reusing!) I have another issue now.Can you see why the following is occurring....
    I placed else in and now it edits the required fields, but once they are completed, will not initiate the email prompt. Here's what I have now
    var emptyFields = [];
    for (var i=0; i<this.numFields; i++) {
         var f= this.getField(this.getNthFieldName(i));
         if (f.type!="button" && f.required && f.display==display.visible) {
              if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off")) emptyFields.push(f.name);
    if (emptyFields.length>0) {
         app.alert("Error! You must fill in the following fields:\n" + emptyFields.join("\n"));
    elsethis.mailDoc({bUI:false,cTo:"[email protected],[email protected],[email protected]",cSubject:"Bugzilla Form for: "+this.getField("Bugzilla Title").value+" - "+this.getField("Bugzilla ID").value})

  • Problem with Html field naming and java script

    Java Script which references html fields uses the
    notation "document.form[0].field". JATO generates field names which
    include the page (view bean). A dot is placed between viewbean name and
    field name(viewbean.field). However "document.form[0].viewbean.field"
    doesn't work as a reference. I'm not a java script person. Am I
    missing something?

    that's correct. You can use the below code for AJAX request.
    <script type="text/javascript">
    var httpObject = getHTTPObject();
    //create XMLHttpRequest object
    function getHTTPObject() {     
         var xmlhttp;
         if (window.XMLHttpRequest) // if Mozilla, Safari etc
              xmlhttp = new XMLHttpRequest();
         else if (window.ActiveXObject){ // if IE
              try {
                   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
              catch ( e ){
                   try{
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                   catch ( e ){}
         return xmlhttp;
    //define the function to send the request
    function sendRequest(){
        var currDesc = document.getElementById("description").value;
        var URL =  "manageMaintAction.do"; //action mapping in your struts-config
        var queryString = "currDesc="+escape(currDesc); //get the currDesc value in your action class like request.getParameter("currDesc")
        httpObject.open( "Post", URL, true );
        httpObject.onreadystatechange = cbFn;
        httpObject.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded");
        httpObject.send(queryString);
    //callback fn
    function cbFn() {
        if (httpObject.readyState == 4)
             if (httpObject.status == 200)
              var result = httpObject.responseText;
              alert(result);
    </script>

  • Saving form field data with Adobe Reader and Java script.

    We would like to create some customized PDF documents with pre filled form  fields for our customers. The documents will also have extended Java script  functionality to check some entered data and to save the form data to a local  disk.
    Our customers will need to click on their personalized link on our web page  and then download a pdf document with personal pre filled form fields  specifically for that customer.  From our site the PDF file will be dynamically  created and partly filled out with our web application. (The application uses an  external PDF library for the pdf creation).
    They would then need to be able to edit the form fields and save/export  them as a pdf whilst offline.
    The saving/exporting of the data should be implemented by the extended Java  Script functionality (http://www.adobe.com/devnet/acrobat/pdfs/js_developer_guide.pdf). Once the data has been edited they will send the pdf file directly back to  us.
    The issue we have is with regarded to teh EULA for Acrobat Reader. If we  create those documents with an external application is the user allowed to open  those PDF files with his Adobe Reader without breaking the Adobe Reader  Restrictions in the EULA for the Reader?  (http://www.adobe.com/products/eulas/pdfs/Reader_Player_AIR_WWEULA-Combined-20080204_1313.pdf, chapter 3.2 Adobe Reader  Restrictions)

    Hello,
    the problem which I have pertains only to the Adobe Reader. Because
    our user will use Adobe Reader to open our pdf documents but it looks
    like that the EULA for the Reader doesn't allow the user to open pdf
    files which have the extended option to save data out of the form
    fields unless!! this feature was created by an adobe product. But I
    created the pdf file not with Adobe. So I don't want our user be punished...
    It is actually a question of the law? departement of Adobe. But there
    is no Forum for that
    Or could you please forward my forum question to somebody of this department.
    I don't want to publish a product where the user breaches the EULA
    every time they are opening it
    Regards
    Niels

  • How to write Java script for refering the 1st page text field from 2nd page?

    Hello I am developing an VISITOR info interactive form with webdynpro ABAP, its with 2 pages. Their heirarchy is,
    VISITOR_form
        |
        |
        |------Page_1
        |            |
        |            |
        |            |------Text_Field_A_1
        |            |
        |            |------Text_Field_A_2
        |
        |------Page_2
                     |
                     |
                     |------Text_Field_B_1
                     |
                     |------Text_Field_B_2
    Now, i have selected the 'Text_Field_B_1' of page_2 and writing the Java script, my requirement is; If Page_1's 'Text_Field_A_2' has a value of "Value_ABCD", THEN the 'Text_Field_B_1' of page_2 should be 'readOnly'. Pls let me know Wht is the Java script for this requirement?

    if (xfa.event.newText=="ABCD")
    VISITOR_form.Page_2.Text_FieldB_1.access ="readOnly";
    place script on change event of Text_FieldA_2

  • How to read the value of Inputfield in WAD in JAVA script?

    Hi Experts,
    I have a requirement in WAD .
    I have put an Input Field (text box), a button and a script control  in the web template.
    In my script control function , I want to read the value entered in the input field using java script. How do I achieve it?
    Thanks in advance.
    Regards
    akshay

    Hi,
    To do this, first you may want to view the HTML source of the report. So, when you have the report launched with the input field, right click and select View Source. Usually it is under a <span> tag with id something like sapbi_snippet_YOURWEBITEMNAME. Most useful commands here are document.getElementById and document.getElementsByTagName.
    You can also access the input web item value using standard sap command SET_SELECTION_STATE_BY_BINDING. Take a look at the documentation on this.
    Hope the above helps.
    Regards,
    wira

  • How to Debug Java Script in Adobe Form

    I have used an alert for empty fields . I have used Check button control for this.
    But the button click is very inconsistent. Some times it triggers the event sometimes it doesnt. Is there anyway to debug the java script. I have installed Script editor for IE but I am unable to use it for Adobe Forms.
    Any help is appreciated.
    Thanks,
    Vasu

    Hi Vasu,
    i think that maybe is the check sequence is not very correct.. and maybe you can try to code it one check for empty fields at a time..
    example
    Name.
    Address.
    Tel.
    Hp.
    Email.
    so u can try to code for one item at a time then slow try to debug it... as last time i use to insert the javascript inside each component then after it i implement into a button and slowly check for the check sequence which one need to be 1st and etc.
    hope it help you. if not maybe u can give more information. maybe i can help you out at myside.
    Regard,
    Ng Jia Jun

  • Is there any way to determine if a link is a book mark or hyperlink in java script

    Is there any way to determine if a link is a book mark or hyperlink in java script
    Sub Problem:
    I am making an array of quads of all the hyperlinks in a document. I would like to automatically skip over all the bookmarks in the starting pages of a document and just get the links of the hyperlinks.
    Now I have to manually set the pages that contain bookmarks so they are not included in the array.
    Is there any way to determine if a link is a book mark or hyperlink in java script?
    It would help automate the conversion I need below
    John
    Main Problem:
    I have been working on converting a set of pdf files with 1000’s of hyperlinks like www.site.com\folder1\file1.pdf#page=10
    To jump to a local copy of the files with a relative type link
    ../folder1/file1.pdf and then go to the proper page.
    I have found that it can be done manually by changing the hyperlink to a javascript
    var otherDoc = app.openDoc('../folder1/file1.pdf', this);otherDoc.pageNum = 10 - 1;
    and setting each destination file with a disclose()=true;
    Based on the help so far that java script cannot access the hyperlink value in a link
    See: http://forums.adobe.com/thread/1039908?tstart=60
    I have resorted to the following plan using acrobat javascript, an external keyboard macro recorder and excel in combination to get around the problem
    Four folder level acrobat javascripts with “buttons”
    One to get all the link quads in an array, in the pdf and report the total number
    The second creates a form field in the far corner of the first page and moves there.
    The third jumps to each link found by creating a form field just to the left of the link and zooms in so it can be selected by a “mouse click” from the keyboard macro recorder 
    The forth deletes the form field
    The keyboard macro recorder runs javascript 2 and then 3 then clicks on the link just to the right of the middle of the screen and uses keys to get to the advanced editing to get to edit the hyperlink .
    The hyperlink is then copied to excel where it is converted using string functions to the needed javascript text to be copied back.
    To the acrobat file into a java script (after deleting the hyperlink)
    Rinse/lather/repeat
    I have been able to convert about 150 links an hour.
    Better then hand typing, but not like having java access to the links.
    I am looking to improve the solution

    thanks for your help.
    I may have been confusing a "acrobat bookmark" and a bookmark in a word file that is converted to a pdf and ends up being a
    link of the type:
    "Go to a page in this document"
    which I do not want in my array vs
    a link of the action type:
    "Open a web link"
    Which I do want
    John
    My code, note how I have to skip pages with "Go to a page in this document" links depending on the document, I would like to use the same code for each document and skip over the "Go to a page in this document" links :
    global.ilinkindex = 1; 
    global.aLinkquads = [ [0, 1, 1, 0, 0],
           [0, 0, 0, 0, 0] ];
    function GetLinkArray()
    global.ilinkindex = 1;
    var iTotalLinks=0;
    // for ( var p = 0; p < this.numPages - 8 ; p++)                   // end before bookmarks for each page of the file x.pdf
    //  for ( var p = 0; p < this.numPages; p++)                     // for each page of the file
    for ( var p = 23; p < this.numPages; p++)                     // start after bookmarks for each page of the file y.pdf
      var cropbox = this.getPageBox("Crop", p);
      var alinksonpage = this.getLinks(p, cropbox);            // get array of links on page
      for ( var ll = 0; ll < alinksonpage.length; ll++)
       var linkquads = alinksonpage[ll].rect;     // get link Quads
       linkquads[4] = p;          // add page number to link Quads array
        global.aLinkquads[global.ilinkindex] = linkquads; // add quads to global link Quads array
        global.ilinkindex++;
    iTotalLinks = global.aLinkquads.length - 1;
    global.ilinkindex = 1;
    app.alert("Number of Links in Document is " + iTotalLinks );

  • How to populate a java script array from a bean.

    Hi all,
    I have a list "mdfProductNames" which is further comprising of two fields "subGroup" and "mdfProductName"
    The list is coming is a part of the form bean.(struts framework)
    Now i want to have the values of these two fields in two different java script arrays.
    i.e. Array x -> mdfProductName
    and Array y -> subGroup
    can someone give me any idea as to how to do this ?
    Thanks
    Edited by: Ramit on 17 Jul, 2008 9:53 AM

    hi,
    assuming u use jstl, u need to create javascript variable during html generation out of the values got from struts form bean. it could look like this:
    ------ .jsp file ----
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <script type="text/javascript">
    var X = [];
    var Y = [];
    <c:forEach items="${formBeanName.mdfProductNames}" var="grpProdName">
    X.push( '${grpProdName.mdfProductName}' );
    Y.push( '${grpProdName.subGroup}' );
    </c:forEach>
    // here u already have the two arrays filled up with data
    </script>
    ------- end of .jsp file
    "formBeanName" is a name of a formbean u use to store the list of your beans
    rafal baton zaczynski
    http://baton.pop.e-wro.pl - tips and codes
    http://www.belysio.com - free mobile localization soft

  • How to integrate a java script date picker with jsf?

    Hi I have a javascript data picker which I want to integrate with a text tield.. that is <jsf:inputtext tag...
    I know about onlclick .. but I am more interested in knowing .. how will the java script set date into that input text field.. i mean how will it recognize the field..

    Pass the input element as 'this' reference to the JS function?onclick="doSomething(this);"This has not much to do with JSF though.

  • How to remove a java script pop up

    Hi,
    I imported a robohelp document from another company and i am
    catering it to my company's needs. The problem is they have popups
    which refer to .bmp and it is in java script. If i highlight the
    word which has the pop up and remove the popup and then highlight
    the normal word again and refer it to my topic in the project
    manger; it still refers to their image and not mine. It is strange
    but true. I don't know how to remove the java script cos each time
    i hover over the highlighted text there are 2 red squares on the
    left and right hand side of the word highlighted which i want to
    change from their image to mine.
    Any help would be much appreciated .
    Thanks,
    Ramya

    please take a look at this
    //--></script></robohelp>
    on the <b style="font-weight: normal;">Environmental
    Consequence</b> window
    captures and displays information that you reported to a
    governmental
    agency, police, rescue center, or internal company sources.
    </p>
    <div class=droptext id=POPUP286607275 x-ss-type=dropdown
    style="display: none;">
    <p class=Graphic style="margin-left: 0in;"><img
    src="agency_notification_tab.bmp"
    x-maintain-ratio=TRUE class=img_whs2 style="width: 1108px;
    height: 120px; border-style: none; border-style: none;"
    width=1108 height=120 border=0></p>
    </div>
    <p class=Body>The following is a description of some of
    the fields that
    display on the <b style="font-weight:
    normal;">Agency Notification</b> tab:</p>
    <ul class=whs3 style="list-style: disc;" type=disc>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight: bold;">Reported
    By</b> - Person who reported the incident to an agency
    or organization.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight: bold;">Agencies
    Notified</b> - Agencies or organizations notified
    about the incident.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight:
    bold;">Contact</b>
    - Contact person at the notified agency or
    organization.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><b style="font-weight: bold;">Notify
    Date</b> - Date the agency was
    notified.</p></li>
    <li class=p-BulletedList1><p
    class=BulletedList1><span style="font-weight:
    bold;">Comment/Report
    Number</span> - This field can be used to record any
    comments, notes,
    agency report/case numbers associated with the agency
    notification. </p></li>
    </ul>
    <p class=TableText><a href="javascript:void(0);"
    onClick="var e; if (parseInt(navigator.appVersion)>=4){e=event;}
    if (parseInt(navigator.appVersion) >=2 &amp;&amp;
    typeof(PopupMenu_Invoke) == 'function')
    PopupMenu_Invoke(e,'','Action
    Buttons','../../03_Getting_Started_files/Action_Buttons.htm','Adding
    a Row','../../03_Getting_Started_files/Adding_Row.htm','Adding Text
    Entries','../../03_Getting_Started_files/Adding_Text_Entries.htm','Deleting
    a
    Row','../../03_Getting_Started_files/Deleting_Rows.htm','Environmental
    Consequence
    Record','EC_Environmental_Consequence_Record.htm','Searching by
    Personnel
    ID','../../03_Getting_Started_files/Searching_by_Personnel_ID.htm','Selecting
    the
    Time','../../03_Getting_Started_files/Selecting_Time.htm');return
    false"
    title="Related Topics" id=a2 style="position:
    relative;"><img src="../../ss_btn_related_topics1.gif"
    alt="Related Topics" style="width: 81px; height: 17px;
    border-style: none; border-style: none;"
    width=81 height=17
    border=0></a><robohelp><script
    type="text/javascript"
    language=JavaScript1.2><!--
    InitEffects('a2');
    //--></script></robohelp>
    </p>
    <script language=javascript1.2
    type="text/javascript"><!--
    kadovTextPopupInit('a1','POPUP286607275');
    //--></script>
    if you could paste this code on your word doc and try to
    search for .bmp it exactly shows where it is used i tried removing
    that line but it acted strange as even when i added a pop up to a
    word it does not show anything in the view mode.

  • Java Script Error while deploying a Model with Value Help

    Hi,
    I am using EP 7.0 SP 10.
    I am trying to deploy a model which includes the Value Help for an Input field, and i am trying to deploy this model.
    The model compiles successfully, but gives a Java Script Error while deploying the model,
    ! Error on Page
    When Click on this java script error, it shows that ,
    Line:14985
    Char 1: Error
    object does n't support this property or method.
    code
    URL: <serverhost>/VCRes/WebContent/VisualComposer6.0/bin/223334.htm?24102006.1712.
    The Same model works in dev server, and it fails in the production server.
    Thanks and Regards,
    Sekar

    Hi jakob,
    Thankyou for your quick response.
    I did a basic model with the help of a documentation which i got from this forums.I created a iView and from there i used Bapi "BAPI_SALESORDER ".
    I created a Input Form and a outpot form (table view).I tested model and am able to get the output.but when i try to deploy it is giving me the error.
    And i think am not paring any formulas here.
    Please guide me.
    thanks and regrads
    Pradeep.B

Maybe you are looking for

  • Setup problem, Non-responsive

    Just bought a brand new MacBook Pro, took it out the box, switched it on - got through the "Select a Language" part; easy enough. Then came, 'Select a County'. I pressed the return key - nothing, moved the cursor to the 'next' arrow - nothing. All I

  • LaserJet 400 MFP Won't scan - "Device is Busy"

    My HP LaserJet 400 MFP refuses to scan either to the network folder I set up, or to a USB drive. It simply displays the message "Device is Busy". I have tried restarting the device, and removing hte network cable, but it continues to display this mes

  • Help needed in connecting to oracle9i

    Hi I am using oracle9i,tomcat5.0&jdk1.4.2. when i tried to connect my application with oracle it is showing " Failed to get connection object from the datasource: org.apache.commons.dbcp.SQL NestedException: Cannot create PoolableConnectionFactory, c

  • Why Doesn't My Ringtone Change?

    I am an owner of a Blackberry Pearl, which is now about a year or so old. I use this with T-Mobile Family friend, and have been trying to change the ringtone on one of my preferred friends.  While I try to change it to chimes or something to be subtl

  • Zipping the ORACLE_HOME as backup before applying a patch

    Hi, I'm reading the and OPatch User's Guide 10g Release 2 (10.2) for Windows and it states there to backup the oracle home before patching. +"You can back up the ORACLE_HOME using your preferred method. You can use any method such as zip, cp -r, tar,