Using JavaScript to Determine a Form's Folder Name

We have an awful lot of forms, and in many cases, our custom JavaScript applies to all forms in a given folder. We would like to determine the form's folder name so that we don't have to list each and every form in a giant "IF" statement.
Has anyone figured out how to determine a form's folder using JavaScript?
Thanks!
- Jake

Jake_Turrell wrote:
I think the only solution to the "refresh" issue would be to somehow query the hsp_object table and grab the parent_id (which for a form is the folder ID). If anyone figures out how to query the application repository from JavaScript,that would be very, very cool.
As the database is server side and javascript is client side you would have to use something like an ajax call that passes the form id into an jsp script, the jsp script would query the repository and return the value to javascript.
Cheers
John
http://john-goodwin.blogspot.com/

Similar Messages

  • Problem with using javascript in interactive adobe form

    Hi All,
        I have a problem when accessing text field value which is present inside a subform using javascript.
    I tried giving data.page4.sub-5.<fieldname>.rawvalue but its not working. Please provide a solution.
    Thank you in Advance.

    Since this question is related to JavaScript running within the Form and not the connection between the form and Web Dynpro - it really belongs in the Interactive Forms by Adobe Forum.

  • Using javascript to redirect a form in portal to a report

    Hi. I am trying to call a report or a dynamic page from a form I created. When I select the query button I want it to show the report or dynamic page based on the parameters I passed in the URL. I have the following javascript functions that get the parameters from the comboboxes.
    Additional PL/SQL Code... before displaying the page.
    htp.p('<script language="JavaScript">');
    htp.p('function getItemInst(form,targetInst)');
    htp.p('{var objname;');
    htp.p(' var selectedInst;');
    htp.p(' for(var j =0; j < form.length; j++)');
    htp.p(' { objname = form.elements[j].name.split(".");');
    htp.p(' if(objname[2] == targetInst)');
    htp.p(' { selectedInst = form.elements[j].value;');
    htp.p(' return selectedInst;');
    htp.p(' }');
    htp.p(' }');
    htp.p('}');
    htp.p('function getItemCip(form,targetCip)');
    htp.p('{ ');
    htp.p(' var objname;');
    htp.p(' var selectedCip;');
    htp.p(' for(var j =0; j < form.length; j++)');
    htp.p(' {objname = form.elements[j].name.split(".");');
    htp.p(' if(objname[2] == targetCip)');
    htp.p(' { selectedCip = form.elements[j].value;');
    htp.p(' return selectedCip;');
    htp.p(' }');
    htp.p(' }');
    htp.p('}');
    htp.p('</script>');
    When I click the query button it uses this code:
    using a query button->onclick javascript event handler
    var v_inst = getItemInst(this.form, "INST");
    var v_cip_course = getItemCip(this.form, "CIP_COURSE");
    var exec_url = "http://"+window.location.hostname + "/pls/portal/MAJOR_APP.PROGRAMOFSTUDYSEARCHRESULTS.show?p_arg_names=p_cip_course&p_arg_values="+v_cip_course+
    "&p_arg_names=p_inst&p_arg_values="+v_inst;
    window.location.href=exec_url;
    My problem is that it doesn't use the new url I created and go to the report. It just refreshes the form page I created. I am I missing a step or something?
    Thanks ;)

    Maybe you could try it like this... I saw this question answered not too long ago.
    Submit Portal Form Values to Portal Report

  • Problem using javascript to submit jsf form, values not submitted

    Greetings!
    I have a t:selectOneMenu where I want the page to be submitted when they change the selected value. At this point, I am able to get the form to submit and reload the page, which is all fine. The problem is that none of the values from the page are not set in the backing bean. I have break points on the setter methods that are not being hit.
    I have tried a number of things from searching multiple forums, but here are snippets from my latest version...
    <h:form>
    <t:commandLink id="hiddenLink" forceId="true" value="test link"
    action="#{pc_PageX.doBtnHiddenLinkAction}"></t:commandLink>
    <t:selectOneMenu id="pageList_top" forceId="true" value="#{pc_PageX.ValueX}"
         onchange="jspellSync(); submitPageX();">
         <f:selectItems value="#{pc_PageX.ListX}" />
    </t:selectOneMenu>
    </h:form>
    function submitPageX(){
         var hiddenLink = document.getElementById("hiddenLink");
         hiddenLink.click();
    }Note that the <t:commandLink> is not hidden, though it will be in the final version if I can get this to work.
    If I click the commandLink myself, the page is submitted with all the page values as expected. If I change the list value, thus using javascript to fire the commandLink's click event, the page is submitted with NO values.
    Can anyone come up with an explanation for this behavior? Or better yet, a solution?
    A couple other things I've tried...
    - Not using a commandLink and using jsf's submit function -> onchange="jspellSync(); submit();"
    - Clicking the link using other ways -> hiddenLink.fireEvent('onclick');
    If all else fails, I'll just add a button that they have to click to submit the form.

    snotmare wrote:
    BalusC wrote:
    I recall this problem in one of the ancient JSF versions. Which JSF version do you use? Do you have any room to upgrade to latest? We're using an IBM implementation of JSF, which is at version 7.0. The IBM implementation appears to be built on the JSF base 1.1.That's not an IBM JSF implementation, they do not have any one, they just have some component libraries which runs on top of some JSF implementation. RAD/WSAD ships by default with Sun JSF RI. Try upgrading to at least 1.1_02 which you can download from the aforementioned link. There's a gap of 2 years (and inherently a lot of bugfixes) compared to 1.1. If the application server used supports Servlet 2.5, you could even upgrade to the latest 1.2.
    We've had other issues with the IBM implementation, which could be the cause in this case too. We've been talking about switching to MyFaces, but there is one feature of the IBM version that we like. It's basically a script collector (hx:scriptCollector) that allows us to do pre-processing on the page.As said before, IBM does not have a JSF implementation. So replacing RI by MyFaces wouldn't make any difference.

  • How to validate People Picket control at client side using javascript/Designer in New form.aspx

    Hi Folks,
    I have list library with 2 columns. where as 1 column is people picker control and it is not mandatory filed .
    When the user open newform.aspx and fill all the column values and submit it should show error message if user not enter any data in people picker control column though it is not a mandatory column.
    How to achieve this by using javascript or sharpoint designer.

    Hello,
    Here is script for that:
    http://social.msdn.microsoft.com/Forums/en-US/f1c2a651-a0fb-484d-af33-e7084439b6c8/validate-sharepoint-people-picker-using-javascript?forum=sharepointgeneralprevious
    http://ankursharepoint.blogspot.in/2012/10/javascript-validation-of-people-picker.html
    Edit your newform.aspx page and add content editor webpart on that page. Then add script on HTML source section.
    Hope it could help
    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 do I use search/find to search for a folder name

    I can successfully use Spotlight and Search in Finder and Mail to find files and emails based on their titles and contents, but how to I use the search functions to find a FOLDER by its name, that I have somehere in my nests of folders - so I can then look inside that folder for what I am looking for.
    The search results never seem to show up any folder names?

    I do have several levels of nested email folders and several hundred folders created over the years. So I was hoping to be able to search for a folder's name, and be taken to it to see it and all of its contents.
    The best I seem to be able to do is search for a word that I hope I remember is in one of the emails in that folder, and then find that email in the search results list - but that list still doesn't tell me where the folder in the nested heirarchy that is my mailbox

  • Using Javascript to reset a form on document load

    I am trying to reset all field vaules on a acrobat form to the default values, when the form is initially loaded.  I am trying to use the resetForm() method in a document level script, but not having any luck.
    I have been able to reset fields after user inputs such as a button that resets the form, or a script the will reset a form prior to importing field data... but I need to ensure all data is removed from the form when the form first loads
    Any ideas?

    I believe you mean a document level JavaScript, Entering Document Level Scripts, since a Folder level script would require the placing of the code into one of the Acrobat Application's JavaScript folder on the user machine, Entering Folder Level Scripts. Placing the JS code as a Document Level Sept will clear the form when the form is opened. One could also use the Page Open action if additional code is added to prevent re clearing the form if part of a multi page document and one navigates back to the original page.
    You should also consider turning off auto complete and auto caching of form data.
    Minimizing Exposure of Personal Information on Public Computers

  • Using JavaScript to submit a form with multiple submit buttons

    I am a newbie to JavaScript, so hopefully someone can answer
    this for me.
    On my user registration form, I have two buttons that submit
    the form, 'check_availability' (to check if the username is
    available) and 'register'. In my PHP script, I check which button
    was pushed by checking which POST value is set,
    $_POST['check_availability'] or $_POST['register'].
    If I set the 'register' button to a JavaScript function that
    validates the form and then submits it, how do I get my PHP script
    to think 'register' was pushed?

    Sorry I used my old captcha script there.
    [php]
    <?
    session_start();
    if(isset($_POST['button_name'])){
    //DO SOMETHING HERE
    } else {
    //Add the page data
    ?>
    [/php]
    "east99" <[email protected]> wrote in
    message
    news:fepqr8$2mr$[email protected]..
    > Firstly name your buttons then use this script:
    >
    > [php]
    > <?
    > session_start();
    > if(isset($_POST['button_name'])){
    > if ($_POST['vercode'] != $_SESSION['vercode'] OR
    $_SESSION['vercode']=='')
    > {
    > // echo '<strong>Error
    Message</strong><br>';
    > $error = '<strong><font
    color="#FF0000">Error
    > Message</font></strong><br>';
    > } else {
    >
    > //Add the page data
    >
    > }
    > ?>
    > [/php]
    >
    >
    >
    > "AngryCloud" <[email protected]> wrote
    in message
    > news:fecu6r$cl5$[email protected]..
    >>I am a newbie to JavaScript, so hopefully someone can
    answer this for me.
    >>
    >> On my user registration form, I have two buttons
    that submit the form,
    >> 'check_availability' (to check if the username is
    available) and
    >> 'register'. In
    >> my PHP script, I check which button was pushed by
    checking which POST
    >> value is
    >> set, $_POST['check_availability'] or
    $_POST['register'].
    >>
    >> If I set the 'register' button to a JavaScript
    function that validates
    >> the
    >> form and then submits it, how do I get my PHP script
    to think 'register'
    >> was
    >> pushed?
    >>
    >
    >

  • Using Javascript to email a form in a workflow process

    I've created an Acroform which will be routed around in a workflow process.  The user will open the form, add information and hit a button which is coded in javascript usng the mailDoc function.
    It works perfectly EXCEPT that each time the document is forwarded, "Adobe Acrobat Pro.pdf" gets appended to the name of the file in the email.  It doesn't actually rename the file, so the file does open properly, but the email looks pretty goofy.
    Example.  The filename is Form14.pdf. 
    When the third person signs off and clicks the email button, the email is created, with the address, subject line and body of the email completed, and the document attached has the little icon and then
    - Form 14.pdf - Adobe Acrobat Pro.pdf - Adobe Acrobat Pro.pdf - Adobe Acrobat Pro.pdf
    Is there some way to prevent it from concatenating like this every time the document is emailed?
    Thanks!!!

    Maybe you could try it like this... I saw this question answered not too long ago.
    Submit Portal Form Values to Portal Report

  • Using Javascript and ScriptUI to create a form that brings in a symbol from library

    Hello everyone,
    I've been trying to pull together the right info to use javascript to create a form to bring in particularsymbols from the symbol library based on the variables taken from the form. I've taken bits and pieces from various sample scripts and tried to make this work, but my problem appears when I try to use conditionals.
    This is a limited version of what I want to do, but it is enough to get the point across.
    1. I want to select a script that has various dropdown boxes. I would like the first dropdown to give me 3 options: 10, 13, 18
    2. I would also like another drop down box that gives me three more options: single needle, double needle, and knife edge.
    3. I would then like it to have an "ok" button and "Cancel" button.
    4. From here when I click the ok button, a symbol is brought in from the library depending on what parameters were given to the form.
    ex. If I selected 10 in the first drop down and double needle in the second, I would like "SYMBOL A" to be pulled from the library and centered on the artboard.
    ex. If I selected 13 in the first drop down and double needle in the second, I would like "SYMBOL B" to be pulled from the library and centered on the artboard.
    I've gotten the UI to pop up and it works as planned as well as bringing in a symbol, my problem comes when I try to incorporate conditionals and functions.
    Here is my script. Please let me know what I'm doing wrong.
    var myDoc = app.activeDocument;
    var Pallette = new Window ("dialog", "Create a Shell");
    Pallette.add ("statictext", undefined, "Fill Opening in Inches:");
    Pallette.orientation = "row";
    var myDropdown =  Pallette.add ("dropdownlist", undefined, ["10", "13", "18"]);
    myDropdown.selection = 1;
    var myButtonGroup =  Pallette.add ("group");
    myButtonGroup.orientation = "column";
    var btnCreate = myButtonGroup.add ("button", undefined, "OK");
    MyFillSelection = myDropdown.selection
    btnCreate.onClick = function () {
        if ( MyFillSelection = "13") {
                   symbolRef = myDoc.symbols["SYMBOL A"];
            symbolItemRef1 = myDoc.symbolItems.add(symbolRef);
           redraw();
    var btnCancel = myButtonGroup.add ("button", undefined, "Cancel");
      Pallette.show ();
    If anyone has any input, it would be much appreciated.
    thanks,

    MyFillSelection = myDropdown.selection is outside the function, so it will always read "13", nothing is making the value change.
    move that line into your function and add the text property to it...MyFillSelection = myDropdown.selection.text;
    then do your if comparisons, that will do it.

  • Search Annotation by its Name Using Javascript

    Hi
    my requirement is to find the annotation using its Annotation name using Javascript
    i.e by entering the Annotation name in my user interface  created by javascript it should set focus to that particular annotation

    I don't think it's possible to do that exactly. You can search for the annotation, but you can't select it. However, you can switch the document to the page where the annotation is located.

  • Bundle install directory - using variables folder name

    Hello,
    I have bundle that has to copy a file to a specific folder in the userdirectory.
    In windows, I can use the %username% variable to get the folder name.
    How can I use that in my bundle .
    Ex : c:\users\%username%\....
    thanks in advance
    Greetings
    Lainkes

    Lainkes,
    The better variable to use would be %USERPROFILE%, which will point to the user profile directory on both Windows XP and Windows 7.
    You have a couple of options for your file copy action - you can either use a batch script within a "run script" bundle, or you can use an "install file" action.
    I'd recommend the "install file" action if it's not a terribly large file since that action results in the file being uploaded to the repository, and therefore does not require any mapped drives or UNC paths in order to copy to the client.
    Simply specify %USERPROFILE% in the "Destination Directory:" box in the install file action.
    Jacob
    Originally Posted by alain-janquart
    Hello,
    I have bundle that has to copy a file to a specific folder in the userdirectory.
    In windows, I can use the %username% variable to get the folder name.
    How can I use that in my bundle .
    Ex : c:\users\%username%\....
    thanks in advance
    Greetings
    Lainkes

  • Automator/Applescript to Rename files when dropped in folder based on parent folder name

    When a file is dropped in a folder ( ParentFolder/Folder/File.pdf )
    I want to rename the file to ParentFolder_Folder_01.pdf
        --Get folder
        --Get ParentFolder
        --Check for next available number and use it.
        If ParentFolder_Folder_01.pdf exists, try _02
    I automator, I have chosen folder action
    Added 'Get selected finder items'
    I have attempted to modify another sript I found here to no avail.
    on run {input, parameters}
        tell application "Finder"
            set theFolder to input as string
            set theNameOfFolder to name of folder theFolder
            set theFiles to every file in folder theFolder
            set theFolders to every folder in folder theFolder
            my ProcessFiles(theNameOfFolder, theFiles)
            my ProcessFolders(theFolders)
        end tell
    end run
    to ProcessFolders(theFolders)
        tell application "Finder"
            repeat with thisFolder in theFolders
                set theNameOfFolder to name of thisFolder
                set theFiles to every file in thisFolder
                set theFolders to every folder in thisFolder
                my ProcessFiles(theNameOfFolder, theFiles)
                my ProcessFolders(thisFolder)
            end repeat
        end tell
    end ProcessFolders
    to ProcessFiles(NameOfOuterFolder, theFiles)
        tell application "Finder"
            repeat with thisFile in theFiles
                set theSuffix to my grabSuffixOfFile(name of thisFile)
                set name of thisFile to NameOfOuterFolder & "_" & theSuffix
            end repeat
        end tell
    end ProcessFiles
    to grabSuffixOfFile(theFile)
        set text item delimiters to "_"
        return (text item 2 of theFile)
        set text item delimiters to ""
    end grabSuffixOfFile

    Normally it is a bad idea to do things with items that are in the attached folder (earlier OS versions will retrigger folder actions when an item is renamed, for example), and you don't need to use a Get Selected Finder Items action since the dropped items are already passed to your workflow (also note that the input items will be a list).
    It looks like you are trying to use multiple passes to add on the folder names, but you will have less of a headache if you build the base name and just deal with the number suffix.  If I understood your naming scheme correctly, the following script should do the trick - it isn't very fast, but should be OK for a few items at a time.
    on run {input, parameters} -- rename input Finder items (aliases) to name of containing folders
      set divider to "_" -- the divider character between name pieces
      set output to {} -- the result to pass on to the next action
      set counter to "01" -- start suffix at one
      repeat with anItem in the input -- step through each item in the input
      set anItem to contents of anItem -- dereference
      tell application "Finder" to if class of item anItem is document file then -- don't mess with folders or applications
      set {itemParent, itemExtension} to {container, name extension} of anItem
      if itemExtension is not "" then set itemExtension to "." & itemExtension
      set grandParentName to name of container of itemParent
      set parentName to name of itemParent
      set newName to grandParentName & divider & parentName & divider & counter
      set documentNames to my getExistingNames(itemParent)
      repeat while newName is in documentNames -- increment counter suffix as needed
                                            set counter to text -2 thru -1 of ("0" & (counter + 1))
      set newName to grandParentName & divider & parentName & divider & counter
      end repeat
      set name of anItem to (newName & itemExtension)
      set end of output to anItem -- alias still refers to the same file even after renaming
      end if
      end repeat
      return the output
    end run
    to getExistingNames(someFolder) -- get base document names (no extensions) from a folder
      set nameList to {}
      tell application "Finder" to repeat with aFile in (get document files of someFolder)
      set {fileName, fileExtension} to {name, name extension} of aFile
      if fileExtension is not "" then set fileExtension to "." & fileExtension
      set fileName to text 1 thru -((count fileExtension) + 1) of fileName -- just the name part
      set end of nameList to fileName
      end repeat
      return nameList
    end getExistingNames

  • Smart collection and folder names with "_"

    I have problems when making Smart Collections based on folder names
    My folder name is 2009_11_20 Mist
    When I make a Smart collection with "Folder" Stars with 2009
    I get a lot of files
    When I change the  2009 to 2009_11 I get no files. Even when I make 2009_ I get no files
    When I change the 2009 to Mist and the "Starts with" to "Contains" again I get the desired files.
    When I change the 2009 to 2009_11 and the "Starts with" to "Contains" again I get no files.
    It seems that LR with Smart Collections cannot handle the "_" character???
    Who can help?

    It's a bug. The usual workaround is to use hyphen as the separator in your folder names instead of an underscore.

  • Using Javascript to calculate monthly payments on form

    I have a single page form where I would like to be able to
    allow the user to choose between making a one time payment or
    monthly payments for a user defined amount. I could easily break
    the form into two pages and calculate the value of the monthly
    payments and display it on the second page if the user selected the
    monthly payment option. What I would like is a single page where
    the monthly payment is determined on the fly when either the user
    selects the monthly payment radio button or when the user defined
    dollar amount is entered.
    I think I have the function determined to do the calculation
    for the monthly payment but I'm unsure as to how to get cf to read
    or display the value. I was trying to use the following with no
    luck:
    <input type=radio name=Installments value="Yes" tabindex=1
    onClick="calculatemonthlypayment(document.forms[0].DonationAmount)">
    <script type="text/javascript">
    function calculatemonthlypayment(donation)
    monthlypayment=(donation/12)
    return monthlypayment
    </script>
    Then trying to output the result like this:
    <cfoutput><input type="text" readonly="yes"
    value="#dollarformat(monthlypayment)#"></cfoutput>
    Any idea what I'm doing wrong or missing? Or is there a much
    better way to accomplish this?

    > <cfoutput><input type="text" readonly="yes"
    value="#dollarformat(monthlypayment)#"></cfoutput>
    You cannot do that. CF code is executed on the server
    (first). The resulting javascript (html, css, ...) code is then
    sent to the browser where it is executed. Since javascript code is
    executed in the client browser,
    after the CF code is already finished, the variable
    "monthlypayment" doesn't exist as far as CF is concerned.
    You can use javascript to both read the donation text field
    amount and calculate the "monthlypayment" amount to display. Here
    is a simple example. You'll need to add validation and number
    formatting.

Maybe you are looking for

  • IOS 7 apps not working on iPhone 3gs

    Hi, We have developed application supporting framework starts from 4.3, now we need update of application. Apple forces to mandatory to deploy new or updated applications only from ios 7 sdk and xcode 5. We have updated my application accordingly for

  • I contacted you yesterday I am having problems downloading free addition Firefox to my laptop. I keep getting a warning.

    My Laptop runs Windows 7 and my E Mail is Yahoo, along with Mozilla Firefox if I can install it without problems. My Desktop which I am on now is XP Please can you help and suggest a site for me I have Firefox on my Desktop with no problem I do not w

  • Handle metadata of configuration objects when transported from DEV to QA?

    All, I was reading this blog /people/sravya.talanki2/blog/2005/11/02/overview-of-transition-from-dev-to-qa-in-xi <i>"Unlike IR when we import the scenarios in ID the configuration metadata will be lost and have to be manually entered in the QA ID. Fo

  • Import PowerPoint Slides w/in Small Region of Slide

    Hi- Is there a way to import PowerPoint slide to only display in a portion of the screen? I'd like to have the PowerPoint slides on about 1/3 of the page, and maintain the content from previous pages to remain in the other 2/3 of the page. Is this po

  • Configuring OSB 2 way SSL

    Hi, We're currently having the following requirement --> Client<--HTTPS-->OSB PS(Server1)<--HTTPS-->OSB BS(Server 2)<--HTTPS-->ExternalSystem This is a synchronous service. Unfortunately, I haven't worked on this requirement previously hence I have l