Help with Javascript syntax for dynamic header / footer...

Hello-

I am very new to JavaScript, but I managed to frankenstein two snippets of code that work well individually, but I can't understand how to make them work together. I am applying a dynamic header and footer to a large number of documents using the batch. Here are two extracts that work, and if someone could help me to combine them, I would be very grateful!

for (var pageNumber = 0; pageNumber < this.numPages; pageNumber ++) {var DateStamp = this.addField ("DateStamp", "text", pageNumber, [10, 15, 600, 0]);} DateStamp.textSize = 12; DateStamp.alignment = 'center'; DateStamp.textColor = color.gray; }

this.setAction ("WillPrint", "this.getField('DateStamp').value = \"THIS DOCUMENT IS VALID FOR 24 HOURS from DATE of PRINTING:-"+ util.printd (" \"mm/dd/yyyy hh: mm tt\", new Date()) "");

for (var pageNumber = 0; pageNumber < this.numPages; pageNumber ++) {var FilePath = this.addField ("path", "text", pageNumber, [10, 782, 600, 767]);} FilePath.textSize = 10; FilePath.alignment = "left"; FilePath.textColor = color.gray; }

this.setAction ("WillPrint", "this.getField('FilePath').value = \"File path: \ "+ this.path");

Thanks in advance for any help!

The only problem is that your second order setAction is overwhelming the first. Simply combine it with a single command, as follows:

this.setAction("WillPrint", "this.getField('DateStamp').value = \"THIS DOCUMENT IS VALID FOR 24 HOURS FROM PRINT DATE: \" + util.printd(\"mm/dd/yyyy  hh:MM tt\",new Date());  this.getField('FilePath').value = \"File Path: \" + this.path;");

Tags: Acrobat

Similar Questions

  • Help with Javascript syntax error

    Hello

    I'm very new to all this. I have manged to write a script that will change the text in the field based on the text of another field. It sometimes "works", but the form freezes and crashes which I assume is because there is something wrong with my script. Any help would be appreciated.

    I put the script in the calculate-> custom calculation script box

    If ((this.getField("Email_Type").value == 'RSVP Reminder')) {}

    Event.Value = "Date:";

    }

    else if ((this.getField("Email_Type").value == 'Login Webinar')) {}

    Event.Value = "Date:";

    }

    else {}

    Event.Value = "";

    }

    I think I solved my problem. It looks like the place to check for each line, I need to declare the variable.

    If ((this.getField("Email_Type").value == 'RSVP Reminder')) {}

    Event.Value = "Date:";

    }

    else if ((this.getField("Email_Type").value == 'Login Webinar')) {}

    Event.Value = "Date:";

    }

    else {}

    Event.Value = "";

    }

  • Need help with the syntax for default message.

    I want to display by default in the layout of lead for Feild "owner of lands":

    IIf (< plRegion_ITAG > = "South", "SG",
    IIf (< plRegion_ITAG > = "North", "AT",
    IIf (< plRegion_ITAG > = "East", "GK",
    IIf (< plRegion_ITAG > = "West" "BM", "Other than thesis it should be NULL")))

    ("Other than these we NULL"-> to do this, I tried a different name)

    SG, THE, BM, GK (little) are my managers society of sales/Terriotory.
    I did not miss anything, the above syntax doesnot work for me.

    Thanks in advance.

    Kind regards
    Ratan N

    Hi Ratan,

    A few notes:
    (A) you are missing a comma between "West" and "BM".
    (B) you must use "and not"
    (C) I'm not sure that you can have a drop down list remain NULL by using the IIf function. Even if you can it won't probably work with "other than these, it must be NULL.
    (D) I suggest that you actually add a value called NULL for the list of choices and after writing the syntax you can disable it to prevent your users from accidentally choose it.
    (E) should look like this:

    IIf (= 'South', 'SG',
    IIf (= 'North', 'AT',
    IIf (= 'Is', 'GK',
    IIf (= 'West', 'NULL', 'WB')))

  • Helps with the syntax of dynamic sql statements

    Hi all
    How can I pass the value of the result of my dynamic select statement to a Ref Cursor?
    I try the following statement but does not work, I get this error:
    ORA-00932: inconsistent data types: expected - was - ORA-06512: at
    Procedure getItems(v_first In number, v_second In Number, arg_Cursor IN OUT CUSTOM_REF_CURSOR) is
         sqlString varchar(3000);
         Begin
           sqlString := 'select* from bla where o.arg_1 = :1 and arg_2 = :2'; 
       
           execute immediate sqlString 
           into arg_Cursor
           using v_first, v_second;
       End getItems;
    Any ideas?
    Thank you

    Johnny
    PROCEDURE getitems (v_first IN NUMBER, v_second IN NUMBER, arg_cursor IN OUT sys_refcursor)
    IS
      sqlstring   VARCHAR (3000);
    BEGIN
      sqlstring := 'select* from bla where o.arg_1 = :1 and arg_2 = :2';
    
      OPEN arg_cursor FOR sqlstring USING v_first, v_second;
    END getitems;
    
  • Need help with incorrect syntax for an update error

    I get the error message below, but I can't understand what I'm doing wrong.

    Run database query error.

    [Macromedia] [SQLServer JDBC Driver] [SQL Server] Incorrect syntax near the keyword 'WHERE '.

    The error occurred in C:\ColdFusion9\wwwroot\Intranet\DM\Admin\Maintenance-BulbBaseType.cfm: line 23

    21: UPDATE [bulb Type of basic table]

    22: SET [BulbBaseTypeDesc] = "#TxtBulbBaseTypeDesc #",.

    23: WHERE ([BulbBaseTypeID] = #TxtID #)

    24: < / cfquery >

    25: < cfset TxtID = 0 >

    I put my cfparam as:

    < name cfparam = 'Submit' default = "" >

    < cfparam name = "TxtID' default = 0 >

    < name cfparam = default "TxtBulbBaseTypeDesc" = "" >

    Thank you. I'm new to ColdFusion and it's someone other code. I appreciate the help.

  • Need help with Javascript for Acrobat 9 Pro

    Hello

    I have created a PDF form in Adobe Acrobat 9 of Profession.  Not having not much experience with Javascript, I found this forum very helpful and have many examples of script used to other issues, I had.  I was hoping that someone could help me with the following script, I tried many variations, cannot operate.

    var ratio = this.getField("ratio").value
    concentration of var = this.getField("concentration").value
    var result = this.getField("result").value
    If (ratio.value > = 50.00)
    {result.value = 'PASS' ;}
    If (ratio.value".value > = 40.00)
    {result.value = 'PASS' ;}
    If ((concentration.value ==61) & & (ratio.value > = 49,25))
    {result.value = 'PASS' ;}
    If ((concentration.value ==61) & & (ratio.value > = 39.25))
    {result.value = 'PASS' ;}
    If ((concentration.value ==62) & & (ratio.value > = 48.50))
    {result.value = 'PASS' ;}
    If ((concentration.value ==62) & & (ratio.value > = 38.50))
    {result.value = 'PASS' ;}
    on the other
    {result.value = "FAIL" ;}

    It's just a piece of code, concentration values run from 61 to 99 and the value of the ratio varies for each value of the concentration, there is a high ratio and a low ratio.  The result of this field to complete the field of results with a SUCCESS or a FAILURE.  This isn't working... any help is greatly appreciated!

    If this script is attached to the Calculate of the "result" field event, if I understand correctly the logicm code should be something like:

    // Get a reference to the ratio field
    var ratio = this.getField("ratio");
    
    // Get a reference to the concentration field
    var concentration = this.getField("concentration"); 
    
    // Default
    var res = "FAIL";
    
    if (ratio.value >= 40.00) {
        res = 'PASS';
    }
    
    if ((concentration.value == 61) && (ratio.value >= 39.25)) {
        res = 'PASS';
    }
    
    if ((concentration.value == 62) && (ratio.value >= 38.50)) {
        res ='PASS';
    }
    
    // Set this field's value
    event.value = res;
    

    If the code is placed elsewhere, you must indicate the location.

  • Hi, I need help with installing updates for CS5

    Hi, I need help with the installation of the updates of CS5. I get the following message: some updates to installation failure. My product is already registered. Can someone help me, please?

    Erkan please download and apply updates directly from updates.

  • Need help with Javascript to get the value of standard report column

    Hi all

    Apex 3.1 version

    I have a query SQL (editable report) region where I need to do validations using a process of OnDemand and javascript. For this posting, I need to use the serial number and id of this same report line item. The function is called when the serial number is changed. I can get the serial number easily because it is a text field, however, the item id is a standard report column (which actually a text field or hidden gives me a checksum error, long story). How can I get the value of the standard report column to set the value of an element of the Application to use in my process of application as well as the serial number? Here is my code below.
    <script>
    
    function f_ValidateSerial(pThis)
    {
        
      // The row in the table
    
      var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    
        //alert('Row is '+vRow);
    
    
      // Display the serial number
        //alert('The Serial Number is '+html_GetElement('f21_'+vRow).value);
    
      
     var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=ValidateSerial',0);
     get.add('F101_SERIAL_NUMBER',html_GetElement('f21_'+vRow).value);
     get.add('F101_INVENTORY_ITEM_ID',+html_GetElement(?????+vRow).value);   // Here's where I need to get the item id to set application item!!
     
     gReturn = get.get();
     
    if (gReturn)
        { 
          alert(gReturn);
        }
     
      if(gReturn)
        { 
          html_GetElement('f21_'+vRow).value = '';
        }
               
    }
    </script>

    Hello

    Ok

    Item ID is standard report column.
    If you enter this Expression HTML column

    #ITEM_ID#
    

    I guess that the substitution of column item Id is #ITEM_ID #.

    Now, you have hidden input form that is not submitted.
    Then in JavaScript

    get.add('F101_INVENTORY_ITEM_ID',+html_GetElement('item_id_'+Number(vRow)).value);
    

    Kind regards
    Jari

  • Help with Javascript for the button Delete

    Hi, Im new JavaScript and have my code works partially, but the trouble with a nested if-then-else statement.

    I have a page element, P4_COUNT, and if its value is 0, the button Delete will allow the user to delete the record. If the number is > 0, a message should appear stating that the record cannot be deleted. That's what I have so far and it works, but the first ELSE is misplaced. This code is the URL target for my button remove.

    JavaScript:var response; response = confirm ("are you sure you want to delete this POC?'");
    If {(response)
    If (document.getElementById('P4_COUNT').value == 0) {}
    doSubmit ('DELETE');
    }
    }
    else {-this other fires when the user hits cancel on the first question above not what I want, I want another one here who said only: "removal cancelled '"}
    -This one should only be fired if p4_count is not equal to 0
    var answer2;
    answer2 = confirm ('you cannot remove this POC, that this POC is associated with a RIF.');
    If {(answer2)
    Alert ('cancelled deletion');
    }
    else {}
    Alert ('cancelled deletion');
    }
    }


    The above should follow this logic:

    Are you sure you want to delete this POC?
    Yes - if p4_count = 0 then
    delete the record
    on the other
    second line: cannot delete this record
    OK - prompt removal cancelled
    Cancel - prompt removal cancelled
    end if;
    Cancel - prompt removal cancelled


    Help, please. Thank you, Laura

    Published by: user8936524 on May 10, 2010 14:14

    Hello

    Try if it works. I didn't test it

    javascript:if($v('P4_COUNT')*1==0){
    var answer=confirm('Are you certain you want to delete this POC?');
    if(answer){doSubmit('DELETE');}
    else{alert('Deletion Cancelled');}
    }else{alert('You may not delete this POC, as this POC is associated to an FRR.');}
    

    BR, Jari

  • Why, after the installation of worm 17 we English, pop up error boxes appear with a syntax for JavaScript Application error?

    Should I uninstall Java application and plug-ins, or return to the worm 16 in which this problem does not occur?

    To avoid confusion:

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox/tools > Modules > appearance).

    • Do not click on the reset button on the start safe mode window or make changes.
  • Helps with the syntax of the workflow for the custom field

    I created a custom field called 'qualified Date '. Our current workflow is at work,

    (PRE ("< SalesStage > '") <>[< SalesStage >]) AND (PRE ("< SalesStage >") = 'Lead')

    The goal is that whenever the opportunity is taken from the stage of lead, it is called.
    However, I don't want the full qualified date when a lead is moved to Closed/Lost.

    Any suggestions on how to change this workflow to make that happen.

    We have a similar workflow, and we use a slight variation of what has suggested Shilei.
    PRE ("< SalesStage > '") <>[< SalesStage >] AND PRE ("< SalesStage >") = 'Lead' AND FieldValue ("< SalesStage > '") <>' closed/lost '.

    Good luck
    Thom

  • Help Adobe javascript syntax

    Hello

    Greetings to all. I am a new to Acrobat javascript and the forum and should be grateful for pointers on a problem with a script that I write.

    The script is automatically filled a text field (Text1) with a fixed number based on selections made in a combobox (ComboBox1) and control (Checkbox1) checkbox. ComboBox1 has 4 ads (DC, AC, BC, AX). Text1 should return the number 3 only if ComboBox1 <>DC and Checkbox1 = checked.

    Individual conditions on their own works. If the below script returns a 3 in Text1

    If (this.getField("CheckBox1").value! = 'Off') {}

    Event.Value = 0.03;

    } else {}

    Event.Value = 0;

    While this also returns a 3 in 1 text

    If (this.getField("ComboBox1").value! = 'DC') {}

    Event.Value = 0.03;

    } else {}

    Event.Value = 0;

    However, when I have them unite, the script fails

    If ((this.getField("CheckBox1").value! = 'Off') & & (this.getField("ComboBox1").value! = 'DC')) {}

    Event.Value = 0.03;

    } else {}

    Event.Value = 0;

    The problem does not seem to include syntax, but after having spent a lot of time looking at it do not see directly. What I am doing wrong?

    Thank you very much

    In all of your codes, you are missing the closing at the end brace...

    If you encounter problems of syntax (like this), then it should be very obvious, because you will get error messages in the JS console when you change the value of any field.

    If it is a problem of logic while there will be no error message, it will not work properly.

  • Help with Javascript to populate a list

    Hello

    I'm doing a smart entry form for a singing competition.

    I have a page of classes to enter and I want folk to be able to check a box for which classes which wish to enter and this will a list of classes and class names on the entry form page.

    I used this code in the box.

    If (event.target.value! = "Off") {//If checkbox is checked

    this.getField("ClassN1").value = "own selection - under 8 years;

    }

    else this.getField("ClassN1").value = "";  Clear the text field if the check box is unchecked

    var solo =]

    for (var i = 1; i < = 7; i ++) {}

    var a = getField('ClassN'_+_i).value

    If (a) solo.push (a)

    getField('ClassName'_+_i).value = «»

    }

    for (var i = 0; i < solo.length; i ++) {}

    var line = i + 1

    var a = getField ("ClassName" + row)

    a.Value = solo [i];

    }

    So when the box is checked, the hidden field ClassN1 contains no "Own Selection - less than 8 years" and I want it to fill a Classname field on the next page. " The whole point of this is that there are 40 classes to choose but I want the classes returned from squash in a list without leaving space. However, nothing appears in the field 'ClassName '.... ».

    I had success with this code on an earlier trial but this time it does not work.

    You can see what the problem is?

    On a side note, ClassN field does not fill when I select the checkbox and fill only when I pick up another field or select another location on the page.  Is there a way to force the field to fill in instantly when the box is checked or unchecked?

    Thank you very much in anticipation. Happy to send the file if anyone can help.

    Peter T

    Found my answer.

    I needed to have domain names with an incremental number at the end of the field to make Javascript work to squash to the top of my list...

    Phew!

    Peter.

  • Help with Javascript Code

    I have need of a few write him a fast JavaScript code. I have no experience in JavaScript, but enough to know what to understand. I'm helping to write a very simple writable document in Adobe Acrobat Pro. We need a code which would be specific when a checkbox is clicked on it auto fills with information in the other text boxes. In other words: If mailing address is the address of work so she fills out this information. I have included my variables with the correct names below.

    Thank you for taking the time. Can anyone help?

    I need something that will:

    If checkbox = 'On '.

    then 'employment Address1' = Address1

    then "employment Ville1" = Ville1

    then 'employment State1' = State1

    then 'Job postal Code' = Zip Code 1

    then 'employment County' = County1

    then 'job City, State Zip1' = city, State Zip1

    on the other

    If checkbox = "Off".

    each the first variables remains empty and accessible writing.

    Double readings:

    this.getField("Job_State1").value; = this.getField("State1").value;

    has a semicolon which it does not belong. The line should read:

    this.getField("Job_State1").value; = this.getField("State1").value;

    Then all of the code is:

    If (event.value! = "Off") {}

    fill in the fields of employment;

    this.getField("Job_Address1").value = this.getField("Address1").value;

    this.getField("Job_City1").value; = this.getField("City1").value;

    this.getField("Job_State1").value = this.getField("State1").value;

    this.getField("Job_Zip_Code").value; = this.getField("Zip_Code1").value;

    this.getField("Job_County").value; = this.getField("County1").value;

    this.getField("Job_City,_State_Zip1").value; = this.getField("City,_State_Zip1").value;

    else {}

    Clear fields;

    this.getField("Job_Address1").value = "";

    this.getField("Job_City1").value; = "";

    this.getField("Job_State1").value; = "";

    this.getField("Job_Zip_Code").value; = "";

    this.getField("Job_County").value; = "";

    this.getField("Job_City,_State_Zip1").value; = "";

    }

    You need to find how to set each field if only one is updated. The combined field may need to be updated by each field component. I use the blur action on and avoid using personal calculation action.

  • Please help with javascript

    Hi all
    In my application, there is a colujmn in a table with the date field (calendar) and 2 other fields. The user is not allowed to enter later in the date field, I used a javascript script and it worked fine, but later I discovered that this works only for the future date, (not months or year) assume that, if the date is November 15, 2010, the error is thrown, otherwise if the date is October 15, 2010, error is thrown , for dates like December 10, 2010, December 10, 2011... error is not thrown, that is to say in the coming months and the year is NOT thrown.
    I used the code below:
    < script language = "JavaScript" type = "text/javascript" >
    function test (SAVE)
    {
    for (var i = 1; i < = 30; i ++)
    {
    "" var i1 = i + "";
    if(i<10)
    I1 = '0' + i;
    var datval = document.getElementById("f04_00"+i1).value;
    If (datval! = null & & datval > ($v ('P10_FUTURE_DATE')))
    {
    Alert ("You entered at a later date that is not valid.");
    document.getElementById("f04_00"+i1).value = ";
    document.getElementById("f05_00"+i1).disabled = true;
    document.getElementById("f06_00"+i1).disabled = true;
    counter ++;

    }
    on the other
    {
    document.getElementById("f05_00"+i1).disabled = false;
    document.getElementById("f06_00"+i1).disabled = false;
    }
    }
    if(Counter==0)
    {
    doSubmit (SAVE);
    }
    }
    < /script >

    If the incorrect date is selected, the first value in the column is disabled and the other columns fades.
    Another problem I'm facing here is the calendar does not close when you selected the value, I have to close it manually.

    Please help me with the code!

    Hello

    OK - you should check the settings on the report and the process.

    For each column in the report, check that reference parameters owner of the Table, name reference Table and column name of reference are executed correctly. Note that the reference column name must match the name of the column or the name of the alias, as defined by the SQL statement.

    For each process, make sure that the owner, Table and primary key column name are executed correctly - it should be the same for all processes in the form of tables.

    Andy

Maybe you are looking for

  • Satellite Pro L670 - 1 M 3 - Chipset in this model

    Hello! I'm looking for help: who knows, what Intel chipset is in the Satellite Pro L670 - 1 M 3? It's the Intel H55 Mobile?If so - is that this chipset in all series production of the 1 M 3? I couldn't find this information on the Toshiba site. Thx a

  • Light Wi - Fi on Satellite P300-1GL

    My internet and everything is fine, but my wireless is still red is supposed to be red or something normally red coz is badBut everything works so there is red I ve just bought this laptop and I wonder why.

  • Windows Vista update error code 00000646 & dt000

    Dear Sir/Madam, I have a problem with windows update, when I updated windows, it says that the error code 00000646 & dt000. can anyone help my problem help me please. Thank you. * original title - Windows update 00000646 error code & dt000, how can I

  • EOS Rebel T6 - remote wireless shutter release

    Community salvation of canon, I'm looking for the remote control for the base EOS Rebel T6 wireless.  Everything I find says that I am unable to since there is no IR sensor on the camera.  Does anyone know of a work around for this issue?  Is that I

  • How to tell if windows Genuine in my pc (Windows 8)?

    How to tell if windows Genuine in my pc (windows 8)?     Original title: Question