How to change the Javascript code to make an exception for a single read command?

Hello


I posted a question earlier in another sub-forum and found this script that makes the form read-only fields. Now, I have a particular coding question.


First of all, here's the code:

var r = app.alert("Are you ready to lock this document?",2,2);
if (r == 4) { // 4 is Yes, 3 is No
  
for (var i = 0; i < this.numFields; i++) {
  
var fname = this.getNthFieldName(i);
  
this.getField(fname).readonly = true; // makes all fields readonly
  
}
}

On the bottom of my form, I have a button that allows you to set the read-only form, but I also have other keys such as "print". How do I change the code above to make an exception for the command of read-only for my buttons so that they are still functional at the bottom of my form? I don't know anything about Javascript then this is a foreign language for me.

Any help is appreciated!

If (f.name == "FieldNameToExclude") continue;

Tags: Acrobat

Similar Questions

  • How to change the region code for DVD ROM on Acer Vista

    See the title, I don't ' want to rewrite this, once again. Thank you

    * original title - my computer won't let me change the region code for my disc drive. I have two different with region 1 and 2 DVDs. How can I change at will? Help! Good grief! My laptop is an Acer with windows vista.*

    Hi Shakira R.

    Please see the following article with useful information about your question:

    http://www.Microsoft.com/windows/windowsmedia/KnowledgeCenter/mediaadvice/0072.mspx

    I hope this helps!

    Debra
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • How to change the resolution of a photo in photoshop for high quality printing?

    I am confused about how to check the actual resolution of an image in Photoshop.

    I understand 72 DPI is set for the web and 300 DPI is normally required for high quality printing but how do you check the dpi in Photoshop. When you go to the size and resolution of the image, it is always in pixels (ppi)? Is it the same thing as the dots per inch?

    For example. If I open a photo in Photoshop and the resolution is 72 dpi can I change this at 300ppi so that's 300 DPI when it goes to print?

    Also is there a way to check the resolution of a picture that has been placed in indesign or illustrator without opening the image in photoshop?

    Thanks in advance

    You should check up to resample it for any nationally - or down.

    If you want to convert to CMYK, you must use the correct profile, the results may not be as expected.

    CMYK profiles are dependent on the device - the press is either calibrated to a known profile (which may be available in Photoshop), or he has a profile, which you would have to get the printer.

    If you want to print an Indesign document, the recommended workflow is to export to PDF and converting CMYK when the pdf file. The CMYK range is smaller than RGB, so unless you're aware of this, you will have a few surprises.

    You cannot print very saturated colors with CMYK and blues often come different looking than RGB.

    If you configure the Color PS with CMYK (workspace) profile settings, you can (work in RGB) press Ctrl + Y and get a glimpse of what will look like colors in CMYK. You can even edit in this mode, tweaking colors, but of course limited by the CMYK range.

    For all this to work and get good results, you must have a calibrated monitor, and it helps it of course to have a good printer, who knows what she's doing. And, if possible, be there during printing. Printing on an offset press is not like printing on your desktop printer - there are much more variable.

  • How to change the request to not remember my password for now to remember my password

    When I started to use Firefox, some sites that I need a password I clicked do not remember my password. How to change this setting for now to remember my password.

    Remove (x) Exceptions: Tools > Options > Security: passwords: Exceptions

  • How to change the font to 'request' a font sets for an entire façade

    Hello together,

    normally all my frontpanels use the apllication font. Now, we have mixed operating systems. Some are still using windows xp, the other windows 7. In windows 7, the standard application font has changed. Under my programs under windows 7 results in ugly frontpanels, according to the new standard application font.

    Y at - it an easy way to set the font for an entire façade. I don't want to score every text and change the font type.

    Thank you very much greetings,.

    Michael

    Press Ctrl + A (select all) and change the font. All the fonts selected style will arise.

  • How to change the javascript for Indesign cs 5 in a version for cc

    Hello

    I have a javascript for Indesign CS5, but I want to use it in Indesign CC, but it won't work

    What should I do, if I can use the script in Indesign CC?

    Kind regards

    EVI

    Why did you change to 10? It must be 5.

  • How to change the icons/resolution to make it smaller?

    After my children to play with my laptop all apears HUGE. How to do everything in its

    normal size? PS I do not know what they pressed for any BIG!

    3 methods...

    1. set DPI:
    Right-click on a free space of the desktop > customize > column to the left, adjust the size of police (in PPP) > uac prompt > click default scale (96 DPI).

    2. resolution:
    Right-click on an open area of the
    Desktop > personalize > Display Setings > move the cursor to the right.
    Check your user manual, see if she tells you what resolution is for your
    computer. My laptop use 1280 x 800
    pixels.

    Here is a table of the guide
    line:


    3. do a system restore. Choose the date when your screen was in good
    size as your restore point.

    Start button > Search box, type system restore > press the Enter key > uac prompt > click on choose a different restore point > next > select dates as your restore point, until the click > next > finish
    To sit and wait. The machine restarts when it's done.

    Note: in case the images that appear in your
    screen are too important that you implement the above methods, going to Safe Mode and run the suggestions that precede it.

    Here's how to get safe mode:
    Shut down your computer > put it back then and immediately and
    several times F8 key tab until you see a black and white screen. Use the up/down
    arrow and select Safe Mode

  • How to change the time code on the timeline in 8.1?

    Where is this button in version 8.1?
    10629711_10205016867162743_7749894533340793738_n.jpg

    Hi mclenny,

    Please post on the Adobe forums.

    You can change it here:

    Thank you!

    Regalo

  • How to change the product key from a pre-installed windows 8 single language x 64

    "My PC manufacturer has made a change of material on my laptop and now it is not activated' this product key is already used on another PC (error Code: 0xC004C008). They gave me a new product key and I tried it. My laptop accepts the key product, but after some time, he is back with the old key and is not activated. Is it possible to change my product key? Thank you.

    Press the Windows key + X

    Click prompt (admin)

    At the command prompt, type the following commands:

    slmgr.vbs - ipk xxxx-xxxx-xxxx-xxxx (to replace the specified in the current product key)

    xxxx-xxxx-xxxx-xxxx - represents your product key

    Press enter on your keyboard

    Leave the command prompt

    Restart your computer

    Try again activate by phone:

    1. press the Windows key + X , and then clickrun, and then type: slui.exe 4


    2. then press the ENTER"" key.

    3. Select your "country" in the list.

    4. choose the option "activate phone".

    5. stay on the phone (do not select/press all options) and wait for a person to help you with the activation.

    6. explain your problem clearly to the support person.

  • How to change the name of a component with javascript?

    Hi, I need to dynamically change the label of a component. I tried:


    If (document.getElementById('P34_ID_OPERACION').value == 2) {}
    document.getElementById('P34_ID_USUARIO_DEST').label = ' meeting:';
    }

    If (document.getElementById('P34_ID_OPERACION').value == 3) {}
    document.getElementById('P34_ID_USUARIO_DEST').label = ' otro text:';
    }


    but does not work.

    any ideas?

    Published by: Andres Vilallave on 16-mar-2010 12:49

    Hello

    Edit the article and you enter the text for the Lable

     Your Lable 
    

    and change the javascript code for

    if (document.getElementById('P34_ID_OPERACION').value==2) {
    document.getElementById('label_id').innerHTML = 'Encargado:';
    }
    
    if (document.getElementById('P34_ID_OPERACION').value==3) {
    document.getElementById('label_id').innerHTML = 'otro texto:';
    }
    

    Kind regards
    Shijesh

  • version of Acrobat reader dc 2015: how to change the highlight color?

    How to change the color of highlight (in dc 2015 of adobe acrobat reader version)?

    Hi Herwig,

    Highlight Select tool, press CTRL + E, Properties window will open, you can change the highlight color for here.

    Kind regards
    Rahul

  • How to change the "TextVariable" via javascript

    Hello

    How can I change the value of a "Custom text Variable" via javascript in indesign CS5?

    I understand that there is a 'content' that is me allotted property, but I can't understand how to set or change.

    Here's the javascript code example for reference.

    var docRef = app.activeDocument;
    
    
    for ( var i = 0; i < docRef.textVariables.length; i++ ) {
    
    
        var textVariableItem = docRef.textVariables[i];
    
    
              // Check for the type
              if (textVariableItem.variableType === VariableTypes.CUSTOM_TEXT_TYPE){
    
    
                        var variableOption = textVariableItem.variableOptions;
      
                        // This will give me the text value of the variable
                        alert("Text Variable " + i + " \n " + textVariableItem.name + "\n" + variableOption.contents);
    
    
                        // But how do I set it? 
                        // The following does not seem to work 
                        variableOption.contents = "New custom text..."; 
              }
    }
    
    // Logic behind this script
    
    // theScript()
    // is a wrapper function to provide functional scope to the entire script
    // This function is invoked at the very bottom of the file
    
    // main();
    // the main function that gathers the initial parameters and launches the dialog box
    
    // function mainDialog(docRef, selectedItems, layers, inputs)
    // A function that creates a dialog box this function is passed as a parameter to a "factory method"
    // called function sfDialogFactory(dialog)
    // which is a general purpose utility for creating dialog boxes.
    
    // The mainDialog function has a callback function that responds to the "comtinue" button and after some validation
    // makes a call to a function called
    
    // function doAction(docRef, inputs, options)
    // This is where the main behvior of the script is suppose to be defined.
    // it is designed to be called AFTER the dialog box return and is the result of the callback inside mainDialog
    // The doAction function receives objects that are parameter holders for various inputs and options that come from the
    // dialog box presented to the user
    
    function theScript() {
    ///////////////////////////////////////////////////
    // BEGIN THE SCRIPT
    //=================================================
    
    ////////////////////////////////////////////////////////////////////////////////
    // SCRIPT MAIN PROCESS
    ////////////////////////////////////////////////////////////////////////////////
    // Main Process
    // The beginning of the script starts here
    // Add main logic routine to this function
    
    // Call Main Function to get the ball rolling
    var elementsData;
    var theDocument = app.activeDocument;
    var inputGroup;
    main();
    
    function main(){
    var theSelectedItems = theDocument.selection;
    var theLayers = theDocument.layers;
    
        var myDialog = sfDialogFactory(mainDialog(theDocument, theSelectedItems), theLayers);
        var result = myDialog.show();
        if (result == 1){
            newAction();
            alert("Done");
            }
        else{
            alert("Not Done");
            }
    }
    
    ////////////////////////////////////////////////////////////////////////////////
    // SCRIPT SUPPORTING FUNCTIONS
    ////////////////////////////////////////////////////////////////////////////////
    // Supporting Functions
    // Include functions that offer partial functionality
    // These functions are called and acted upon within the mainProcess function
    function newAction(){
    
            var formData = getControlValues(inputGroup);
            var inputs = {};
            var options = {};
           // alert("callback get form data");
          // Do something with formData values here
            var cLen = formData.controls.length;
            var formValues = '';
            for (var c = 0; c < cLen; c++ )
            {
                if (formData.controls[c].name === "inputECONumber") {
                    inputs.inputECONumber = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentName") {
                    inputs.inputDocumentName = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentNumber") {
                    inputs.inputDocumentNumber = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentRevision") {
                    inputs.inputDocumentRevision = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
    
                if (formData.controls[c].name === "inputDocumentType") {
                    inputs.inputDocumentType = formData.controls[c].value;
                    // alert(formData.controls[c].name + " | " + formData.controls[c].value);
                }
            }//End FOR
        doAction(theDocument, inputs, options);
        }
    
    function mainDialog(docRef, selectedItems, layers, inputs) {
    
    // Main Dialog
    // alert("Main Dialog: " + docRef.name);
    
    if ( docRef === undefined ) {
      alert("Cannot Execute, please select a document.");
    }
    
      var currentData = getMetaData();
    
      var dialogObj = {};
    
      dialogObj.groups = []; // An array of dialog groups
      dialogObj.title = "Update Meta Data";
    
      var groupLabelInfo = {};
      groupLabelInfo.title = "Edit: " + docRef.name;
    
      // Add Elements using JSON shorthand syntax
      groupLabelInfo.elements = [
        {
            "name":"labelECONumber",
            "type":"statictext",
            "value":"Engineering Change Order (ECO) Number",
            "visible":true
        },
        {
            "name":"inputECONumber",
            "type":"edittext",
            "value": currentData.inputECONumber,
            "visible":true
        },
    
        {
            "name":"documentName",
            "type":"statictext",
            "value":"Document Name",
            "visible":true
        },
        {
            "name":"inputDocumentName",
            "type":"edittext",
            "value": currentData.inputDocumentName,
            "visible":true
        },
    
        {
            "name":"documentNumber",
            "type":"statictext",
            "value":"Document Number",
            "visible":true
        },
        {
            "name":"inputDocumentNumber",
            "type":"edittext",
            "value": currentData.inputDocumentNumber,
            "visible":true
        },
    
        {
            "name":"documentRevision",
            "type":"statictext",
            "value":"Revision",
            "visible":true
        },
        {
            "name":"inputDocumentRevision",
            "type":"dropdownlist",
            "value": currentData.listRevisions,
            "visible":true,
            "selection":currentData.selectionRevision,
        },
    
        {
            "name":"documentType",
            "type":"statictext",
            "value":"Label Type",
            "visible":true
        },
        {
            "name":"inputDocumentType",
            "type":"dropdownlist",
            "value": currentData.listDocumentTypes,
            "visible":true,
            "selection":currentData.selectionDocumentType,
        },
    
      ];
    
      // Add to groups to list
      dialogObj.groups.push(groupLabelInfo);
      return dialogObj;
    }
    
    function doAction(docRef, inputs, options) {
    
    alert("doAction " + docRef.name + " \n INPUTS: \n" + inputs.reflect.properties + "\n\n OPTIONS: \n" + options.reflect.properties);
    
    // Get the current contents
    
    var fooContents = app.activeDocument.textVariables.item ('Foo').variableOptions.contents;
    var barContents = app.activeDocument.textVariables.item ('Bar').variableOptions.contents;
    
    alert("GET textVariable contents \n Foo: \n" + fooContents + "\n\n Bar: \n" + barContents);
    
    // Set/Update the contents
    // Why does this not seem to work?
    
    alert("SET textVariable contents \n Foo: \n" + inputs.inputDocumentName + "\n\n Bar: \n" + inputs.inputDocumentType);
    
    app.activeDocument.textVariables.item ('Foo').variableOptions.contents = inputs.inputDocumentName;
    app.activeDocument.textVariables.item ('Bar').variableOptions.contents = inputs.inputDocumentType;
    
    // Script does not seem to reach this point. Why?
    alert("END of doAction");
    }
    
    // A Factory function for creating dialog boxes
    
    function sfDialogFactory(dialog) {
    
        // A factory method for creating dialog screens
    
        // Dialog Window
        var d = new Window("dialog", dialog.title);
    
        // alert("Number of Inputs" + dialog.inputs.length);
        // alert("Number of Options" + dialog.options.length);
    
        var i; // counter
        var len; // length of array elements
    
        // Generate Groups
        if (dialog.groups.length > 0) {
    
            len = dialog.groups.length;
            for (i = 0; i < len; i++ )
            {
                var currentGroup = dialog.groups[i];
                inputGroup = d.add ("panel", undefined, currentGroup.title);
                    inputGroup.alignChildren = ["fill","fill"];
    
                if (currentGroup.elements.length > 0) {
                    // Add Elements
                    var ii;
                    var elemLen = currentGroup.elements.length;
                    for (ii = 0; ii < elemLen; ii++ )
                    {
                        var currentElement = currentGroup.elements[ii];
    
                        var el = inputGroup.add(currentElement.type, undefined, currentElement.value);
    
                        // Additional properties added for future reflection
                        el.elName = currentElement.name;
                        el.elIndex = ii;
    
                        switch(currentElement.type)
                        {
                            case "statictext":
                                el.visible = currentElement.visible;
                            break;
                            case "edittext":
                                el.visible = currentElement.visible;
                            break;
                            case "dropdownlist":
                                el.visible = currentElement.visible;
                                el.selection = currentElement.selection;
                                el.onChange = currentElement.onChange;
                            break;
                            case "checkbox":
                                el.visible = currentElement.visible;
                                el.value = currentElement.value;
                            break;
                            default:
                            throw new Error('Unknown Dialog Element Type [' + currentElement.type + ']');
                        }
    
                    }
                }
            }
        }
    
      // Buttons Group
      var buttonGroup = d.add("group");
      var bOK = buttonGroup.add("button", undefined, "Continue", {name: "ok"});
      var bCANCEL = buttonGroup.add("button", undefined, "Cancel", {name: "cancel"});
    
      return d;
    }
    function getControlValues(set) {
        elementsData = {};
        elementsData.controls = [];
        // TO DO Add more types
    
        var giLen = set.children.length;
        for (var gi = 0; gi < giLen; gi++ )
        {
            var child = set.children[gi];
            // alert(objReflection(child, "none", false));
            // alert(child.type);
            var control = {};
                control.name = child.elName;
                control.index = child.elIndex;
                control.type = child.type;
                control.visible = child.visible;
            switch(child.type)
            {
                case "statictext":
                    control.value = child.text;
                break;
                case "edittext":
                    control.value = child.text;
                break;
                case "dropdownlist":
                    control.value = child.selection.text;
                break;
                case "checkbox":
                    control.value = child.value;
                break;
                default:
                throw new Error('Unknown Dialog Element Type');
            }
            elementsData.controls.push(control);
            // alert(objReflection(control, "none", false));
        }
        return elementsData;
    }
    function getMetaData() {
    // Return a data structure that contains meta data from the document.
    
        var dataObject = {};
    
         // Default arrays
         dataObject.listRevisions = generateRangeOfNumbers ("r", 1, 100);
         dataObject.listDesignComps = generateRangeOfNumbers ("Comp_", 1, 100);
         dataObject.listDocumentTypes = [
                         "Datasheet",
                         "Manual",
                         "Tech Guide",
                         "Other"
                     ];
    
         // Set Sensible Default Values for the UI Form
         if (!dataObject.inputECONumber) {
             dataObject.inputECONumber = "###ECO###";
         }
    
         if (!dataObject.inputDocumentName) {
             dataObject.inputDocumentName = "Document Name";
         }
    
         if (!dataObject.inputDocumentNumber) {
             dataObject.inputDocumentNumber = "048-xxx-30";
         }
    
         if (!dataObject.inputDocumentRevision) {
             dataObject.inputDocumentRevision = "r01";
         }
    
         if (!dataObject.inputDocumentType) {
             dataObject.inputDocumentType = "Datasheet";
         }
    
         return dataObject;
    
    }
    
    function generateRangeOfNumbers (prefix, start, end) {
        // This function generates an array of sequential numbers within a range
        // prefix = string to append to beginning of each element
        // start = the beginning of the range
        // end = the end of the range
        // length = overall number of cycles to loop through, start and end must fall within this value
    
        var output = [];
    
        for ( var i = start; i <= end; i++ )
        {
            if (i < 10) {
                // Add a leading zero
                output.push(prefix + "0" + i);
            }
            else {
                output.push(prefix + i);
            }
        }
    
        return output;
    }
    
    //=================================================
    // END THE SCRIPT
    ///////////////////////////////////////////////////
    }
    
    theScript();
    

    I modified your code shortly. He works for me here. Check it out...

    Thank you

    Green4ever

  • Our phone will make more phone calls, and we do not know how to change the settings to restore the capabilities of phoning.

    Our phone will make more phone calls, and we do not know how to change the settings to restore the capabilities of phoning.

    Greetings jenniferfrom46,

    From your post, I see that you are unable to make phone calls. I count on the ability to use my phone a lot to make calls, so I can understand your concern. I will be happy to provide you with some information for you.

    If you can not make or receive calls on your iPhone, this article goes on measures to take to help with the issue you are experiencing.

    Have a good!

  • How to change the language settings in firefox using JavaScript

    My question is: how to change the language settings in the use of JavaScript in firefox:

    I want to set the value of intl.accept_languages en using JavaScript.

    How can I do?

    EDIT: The reason mail, I want to do is to be able to run selenium for different languages test scenarios with manually change them rather progrmmetically

    You will need to close and open the pref via user.js or prefs.js before restarting Firefox to perform the next test.

    See:

  • How to change the duration of the clip in Movie maker

    Im trying to use windows movie maker. does anyone know how to change the duration of the clip. I made a movie of my meetings previous families, but it is different duration time. I'm still doing, help menu does not explain.

    I tried different methods to change the time on the tag's options, but it does not change the duration of the clips

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Hi Rickysbiz,

    You can try to cut the clip and take a fresh start or endpoint for the clip to set the duration. The start trim point determines when the clip will start playing, and the end trim point determines when the clip stops in your project and final film.

    To trim a video clip

    1. If you are in the Storyboard view, click, and then on the timeline.

    2. in the timeline panel, click the clip you want to cut.

    3 use the controls to play under the preview monitor to find the point where you want to cut out the clip.

    4 follow these steps:

    ·        When the playback indicator is at the location where you want the video or audio clip selected in replay, clickClip and then click TrimBeginning.

    ·        When the playback indicator is at the location where you want the video or audio clip selected to stop playback, clickClip, and then click TrimEnd.

    You can access the link below to learn more about wrking with clips in Windows Movie maker.

    http://Windows.Microsoft.com/en-us/Windows-Vista/work-with-clips-in-Windows-Movie-Maker

    I hope this helps. Let us know the result.

    Thank you and best regards,

     

    Srinivas R

    Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

Maybe you are looking for