First try at creating a Form/Using Javascripts

Looking for constructive criticism. I am an instructor in the US Navy and I am forced to type out a boring routing sheet when submitting anything that needs approval from anyone other than myself. I finally decided to try my hand at Adobe Acroboat X Pro and this is the end result. Please feel free to criticise/help me build on this first attempt ever to write code. In my first attempt at using acrobat's Javascript editor I have discovered that it is a complete nightmare and not very userfriendly. I could write a string and save it only to find out that next time I went back to edit something it would tell me that I had a syntax in something that was a known good! Very aggrivating! Does anyone know if/where the limits of the java script are located? I was getting some problems while writing the strings at around line #40 so I would back it up to line #39, save it, then go back in and I could magicaly go past line 40. Anyone seen anything like this before?
//-----------------Do not edit the XML tags--------------------
//<Document-Level>
//<ACRO_source>SetFieldValues</ACRO_source>
//<ACRO_script>
/*********** belongs to: Document-Level:SetFieldValues ***********/
// Place all prepopulation data into a single data structure
var Sheet = {
"Graduation Certificates":{
Enclosure: "Graduation Certificates, Class Roster",
To1: "Commanding Officer",To2: "Executive Officer",To3: "Technical Director",To4: "Command Master Chief",To5: "Director of Training",To6: "Admin Officer",To7: "Department Head",To8: "Department LCPO",To9: "Division Officer",To10: "Division LCPO",To11: "Branch LCPO",To12: "LPO"},
"24hr Special Liberty":{
Enclosure: "Special Request Chit",
To1: "Branch LCPO",To2: "LPO",To3: "",To4: "",To5: "",To6: "",To7: "",To8: "",To9: "",To10: "",To11: "",To12: ""},
"48hr Special Liberty":{
Enclosure: "Special Request Chit",
To1: "Department LCPO",To2: "Division Officer",To3: "Division LCPO",To4: "Branch LCPO",To5: "LPO",To6: "",To7: "",To8: "",To9: "",To10: "",To11: "",To12: ""},
"72hr Special Liberty":{
Enclosure: "Special Request Chit",
To1: "Department Head",To2: "Deparment LCPO",To3: "Division Officer",To4: "Division LCPO",To5: "Branch LCPO",To6: "LPO",To7: "",To8: "",To9: "",To10: "",To11: "",To12: ""}};
function SetFieldValues(cSubject)
  this.getField("Enclosure1").value = Sheet[cSubject].Enclosure;
  this.getField("To 1").value = Sheet[cSubject].To1;
  this.getField("To 2").value = Sheet[cSubject].To2;
  this.getField("To 3").value = Sheet[cSubject].To3;
  this.getField("To 4").value = Sheet[cSubject].To4;
  this.getField("To 5").value = Sheet[cSubject].To5;
  this.getField("To 6").value = Sheet[cSubject].To6;
  this.getField("To 7").value = Sheet[cSubject].To7;
  this.getField("To 8").value = Sheet[cSubject].To8;
  this.getField("To 9").value = Sheet[cSubject].To9;
  this.getField("To 10").value = Sheet[cSubject].To10;
  this.getField("To 11").value = Sheet[cSubject].To11;
  this.getField("To 12").value = Sheet[cSubject].To12;
//</ACRO_script>
//</Document-Level>
//<AcroForm>
//<ACRO_source>Subject:Keystroke</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:Subject:Keystroke ***********/
if( event.willCommit )
   if(event.value == " ")
     this.resetForm(["Enclosure1","To 1","Legend 1"]);
   else
     SetFieldValues(event.value);
//</ACRO_script>
//</AcroForm>

Unless you are really really good at editing JavaScript, I would not use the "Edit All Scripts", it is far to easy to make a mistake.
It might be more helpful to have a copy of the form with JavaScirpts.
It looks like you are trying to set a second or more drop down box using a data object.

Similar Messages

  • How to create a form using dblink

    dear all
    I am using Ora11g Xe, i have created a dblink of another database user; now i would like to create a form using apex, would anybody can guide me how to go about it? i have tried with normal procedure of creating a form (using client@cmd ie tablename@dblink name) but it didn't work;
    thanks in advance
    uday

    My first preference wouldn't be to use a DB link as opposed to some APIs on the target database that I can call from the form.
    Reason being that there are some things that may best not controlled over a DB link.
    However if you have a really simple case and really have to use this method then in theory you could try creating a synonym pointing to the remote DB object and hopefully Apex should treat it the same as a local object.
    Warning, I've never tried it :-).

  • Creating adobe form using SFP

    hi experts,
    I am trying to create Adobe form using transaction SFP ,  the form creation goes on smoothly but when I try to save or activate it or press any button it displays Error message  "Error when transforming object data". Please tell me what could be the reason of this error  and how can I rectify it.
    Points will be rewarded.
    Many thanks,
    Sushant

    Hello,
    Check <a href="https://service.sap.com/sap/support/notes/962763">the SAP note 962763</a>.
    Rgds,
    Francois

  • Creating a form using Acrobat 9

    I'm trying to create a form using Acrobat 9 and know how to insert check boxes and text fields but when I enter in data into the fields it copies it through the document.  How can I create a field that I can cut and paste throughout the document but allow it to have separate data in it from the rest of the fields?

    You'll need to rename all of the fields you copy & paste so that each one
    of them has a unique name. Fields with the same name will automatically
    have the same value.

  • I created a form using acrobat XI pro.  SOME users of the form cannot save the form.  what can i do from my side to 'correct' the issue?

    i created a form using acrobat XI pro.  SOME users of the form cannot save the form.  what can i do from my side to 'correct' the issue?

    Do you know what PDF viewer those users were using? Do you have any more details about what happens when they attempt to save?

  • How to seperate current page fields in a pdf form using javascript

    Hi,
    Is that possible to seperate current page fields(textbox, Chesckbox) in a pdf form using javascript.
    I have coding to get all the fields in a pdf form. But i want to take CURRENT PAGE alone.
    Please help me out.
    Thanks and regards,
    Christy

    Hi try67,
    Thanks for your support.
    I got the result.
    Thanks and Regards,
    Christy

  • Set "peoples or groups" field with current user "login name" in sharepoint list form using javascript

    hi friends
    i am trying to set peoples or groups field in sharepoint  list form with current user login name
    here my code
    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
    <script type="text/javascript">
    $(document).ready(function NewItemView () {
    var currentUser;
        if (SP.ClientContext != null) {
          SP.SOD.executeOrDelayUntilScriptLoaded(getCurrentUser, 'SP.js');
        else {
          SP.SOD.executeFunc('sp.js', null, getCurrentUser);
        function getCurrentUser() {
          var context = new SP.ClientContext.get_current();
          var web = context.get_web();
          currentUser = web.get_currentUser();
          context.load(currentUser);
          context.executeQueryAsync(onSuccessMethod, onRequestFail);
        function onSuccessMethod(sender, args) {
          var account = currentUser.get_loginName();
          var accountEmail = currentUser.get_email();
          var currentUserAccount = account.substring(account.indexOf("|") + 1);
        SetAndResolvePeoplePicker("requester",account);
    // This function runs if the executeQueryAsync call fails.
        function onRequestFail(sender, args) {
          alert('request failed' + args.get_message() + '\n' + args.get_stackTrace());
     function SetAndResolvePeoplePicker(fieldName, userAccountName) {
       var controlName = fieldName;
        var peoplePickerDiv = $("[id$='ClientPeoplePicker'][title='" + controlName + "']");
        var peoplePickerEditor = peoplePickerDiv.find("[title='" + controlName + "']");
        var spPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerDiv[0].id];
        peoplePickerEditor.val(userAccountName);
        spPeoplePicker.AddUnresolvedUserFromEditor(true);
    </script>
    but it is not working
    please help me

    Hi,
    According to your post, my understanding is that you wanted to set "peoples or groups" field with current user "login name" in SharePoint list form using JavaScript.
    To set "peoples or groups" field with current user "login name”,  you can use the below code:
    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.js"></script>
    <script type="text/javascript">
    function SetPickerValue(pickerid, key, dispval) {
    var xml = '<Entities Append="False" Error="" Separator=";" MaxHeight="3">';
    xml = xml + PreparePickerEntityXml(key, dispval);
    xml = xml + '</Entities>';
    EntityEditorCallback(xml, pickerid, true);
    function PreparePickerEntityXml(key, dispval) {
    return '<Entity Key="' + key + '" DisplayText="' + dispval + '" IsResolved="True" Description="' + key + '"><MultipleMatches /></Entity>';
    function GetCurrentUserAndInsertIntoUserField() {
    var context = new SP.ClientContext.get_current();
    var web = context.get_web();
    this._currentUser = web.get_currentUser();
    context.load(this._currentUser);
    context.executeQueryAsync(Function.createDelegate(this, this.onSuccess),
    Function.createDelegate(this, this.onFailure));
    function onSuccess(sender, args) {
    SetPickerValue('ctl00_m_g_99f3303a_dffa_4436_8bfa_3511d9ffddc0_ctl00_ctl05_ctl01_ctl00_ctl00_ctl04_ctl00_ctl00_UserField', this._currentUser.get_loginName(),
    this._currentUser.get_title());
    function onFaiure(sender, args) {
    alert(args.get_message() + ' ' + args.get_stackTrace());
    ExecuteOrDelayUntilScriptLoaded(GetCurrentUserAndInsertIntoUserField, "sp.js");
    </script>
    More information:
    http://alexeybbb.blogspot.com/2012/10/sharepoint-set-peoplepicker-via-js.html
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Creating & managing forms using ALBPM

    Hi,
    I am new onALBPM & hoping that gurrus can guide me in following task.
    Creating & manging Forms using ALBPM & a XSD file.
    I am looking for some example & tutorial for above task
    Edited by: user586236 on Dec 17, 2008 3:26 PM

    Hello,
    Are you using any web service? Which .NET framework is installed in your PC?
    You might also want to look at this resolution:
    http://www.itjungles.com/task-failed-because-sgen-exe-was-not-found-solution.html
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to create arabic forms using adobe central forms

    How to create arabic forms using adobe central forms

    Any luck here? I have just a subset of your challenge, i.e., I want to get forms designed in Designer 8.2/Acrobat 9 to work in Reader 7.0.5
    Thanks!

  • To create login form using swing with sqlserver as backend

    hi.
    can anybody send me code to create login form using swings .
    thnaks in advance..
    sj

    You do realise that you can't create Swing on a JSP page?
    You have to use HTML.
    If you want to use Swing, the java must be running at the client end, which means you need an Applet, and a completely different forum.

  • Email form using JavaScript

    I would like to perform certain validations when user clicks the email button. However, I am unable to enter any JavaScript in the click event. This event is disabled.
    Is there a way to email a form using JavaScript (not through the Submit tab)? This way I can run the validations in the click event, before emailing the form.
    Any other suggestions are welcome.
    Thanks
    Aditya

    Aditya,
    A common solution is to use two buttons. Add a Email Submit Button object and define the presence as 'invisible'. Let's name the object 'EmailSubmitBtn'. Add a Button object and change the caption to 'Email'. Let's call the object 'EmailBtn'. One the 'EmailBtn' click event perform the required validations and then call the click event on the 'EmailSubmitBtn'. You call the 'EmailSubmitBtn' click event as follows:
    form1.subform1.EmailSubmitBtn.execEvent("click");
    Steve

  • Reset form using javascript

    Hello,
    I am using jdev 11.1.1.6
    I want to know how to reset the form using javascript.
    For instance...<af:resetActionListener/> does it in jsff
    I need similar implementation

    One solution could be calling a backing bean method from client and reset the form in the backing bean method.
    var customEvent = new AdfCustomEvent(evt.getSource(),"resetFormEvent",null, true);
    customEvent.preventUserInput();
    customEvent.queue(true);

  • Multiple recipient livecycle form using javascript in it to attach a pdf, external recipients get MIME formatted email.

    The livecycle designed form has javascript to send the form to 4 recipients.  The form worked fine until the mail domain was hosted by gmail (uses TLS, port 587).  Now recipients get a MIME email, not the attached PDF.  Old versions of the form pre-sept 29 work fine.  If we change the form or copy it, it does not work.  If we use a different smtp server to test, it works fine, all 4 recipients get the pdf.  Any advice is much appreciated!  I'd say gmail is the problem, but then why do old forms work fine still through gmail?
    the setup is Adobe Livecycle Designer ES4, Adobe Acrobat XI, Outlook 2007, gmail hosted company domain (ex. yourdomain.com), using SMTP port 587 TLS, javascript in the email to declare a PDF, and a button to run the javascript (not a submit button, the javascript does the submit action).
    problem looks like this:
    EARLY WORKS - PHASE 5, PILING - Change Order 888 
    Date: Fri, 9 Jan 2015 13:08:55 -0600 
    Message-ID: <002e01d02c3f$b802fdf0$2808f9d0$@ca> 
    MIME-Version: 1.0 
    Content-Type: multipart/mixed; 
                    boundary="----=_NextPart_000_002F_01D02C0D.6D688DF0"
    X-Mailer: Microsoft Office Outlook 12.0 
    Thread-Index: AdAsP5IQYfLzQOmBQKGrI/ckRv3akg==
    Content-Language: en-ca
    This is a multi-part message in MIME format.
    ------=_NextPart_000_002F_01D02C0D.6D688DF0
    Content-Type: text/plain;
         charset="us-ascii"
    Content-Transfer-Encoding: 7bit
    The contract has been adjusted by Change Order attached. Please retain copy
    for your file records. No hardcopy will be issued by mail.
    ------=_NextPart_000_002F_01D02C0D.6D688DF0
    Content-Type: application/pdf;
                     name="2785-5 Change Order TEST-Jeff-888.pdf"
      Content-Transfer-Encoding: base64
      Content-Disposition: attachment;
                      filename="2785-5 Change Order TEST-Jeff-888.pdf"
    JVBERi0xLjcNJeLjz9MNCjI1NiAwIG9iag08PC9MaW5lYXJpemVkIDEvTCAxMDc2MTkyL08gMjYx
      L0UgMTA1MjQ1Ni9OIDEvVCAxMDc1ODI1L0ggWyA3MTQgMzI5XT4   etc... 

    First of all, a drop-down menu doesn't allow for multiple item selection. You'll need a list-box field for that.
    Once you have that set up you can use the value(s) selected in this field as the recipients of the email.

  • Acrobat X Form using Javascript problem

    I have a Acrobat Form which I originally created in Acrobat 7 Pro that has a button which executes many lines of javascript.  In the javascript there is a large if then else statement group that sets a variable.
    I have not worked on this form in many years and recently opened the form using Acrobat X Pro and edited all of the javascript code.  The problem is that when I save the document and click on the button it is still executing the previous javascript code for some reason.  I have looked everywhere I can think of to make sure there is no remnant of the old code left and cannot find any.  It seems like there is a cached copy of the old code somewhere that is being used.  I have looked in the properties of the button and in the all javascript area of the forms menu and cannot find any reference to the old code.
    Any Idea why this is happening?
    Nick B

    The Javascript code populates a field on the form and the If Then statement sets this value based on  the amount in another field.  I have changed all of the values in the If Then statement but the button is still using the old values.
    I have tried this on three different computers and it will not pick up the new values. 

  • Submittin form using javascript

    Hi friends
    I have used the following javascript method to submit a form using an href from my
    JSP
    <a href="# onClick="return submitMe(document.item,<%=activeWhse.getBowhse()%">)"
    Javascript function is like this
    function submitMe(myform,whse){
              myform.powhse.value=whse;
              myform.submit();
              return true;
    It does not work on IE 5 but works on IE 5.5 .
    Is there any thing wrong on how I am doing it ?
    Please advise
    Thanks in advance
    </a>

    Try using
    submitMe(document.item,<%=activeWhse.getBowhse()%)
    Thanx and Regards
    Aruneesh

Maybe you are looking for

  • I can't view a pdf file in Safari 5.1.7 (windows)

    I'm using Safar 5.1.7 on a computer running Windows XP and I can't seem to open a pdf file. And I'm not able to get to the Safari extensions page - I get an error message that Safari can't establish a secure connection to the server "extensions.apple

  • Query returns different Explain Plan

    Hi, I have two databases that are identical to each other. But I have a query that runs on both and returns different explain plans in both. It runs slower in one than other. How can I troubleshoot this further to get faster times in the slower datab

  • Samba on Solaris 10 in native ADS environment

    Despite crowing about Solaris 10 and integration with Active Directory, this is not quite ready for prime time. Here's the issue: In a native Active Directory Services environment (as opposed to 'mixed mode'), Samba on Solaris 10 cannot create an AD

  • "Insufficient privileges"-error when starting database when on network

    Hi I have an Oracle 9.2.0.5 database installed on my laptop (Windows 2000 Prof), but I have a small problem. When I'm plugged in to the company's network, I can start the database normally. However, when I'm not connected to the company network, i.e.

  • 0 bytes free of 613 MB

    Hi, I have problem with Nokia 808. When I check memory I see "0 bytes free of 613 MB" Why? I did reset *#7370#, but I still have "0 bytes free of 613 MB" Does anybody have any idea? Waldek Solved! Go to Solution.