Javascript Help needed

We have a requirement to not display report until the user selects some requirements, and we also need to ensure a user has selected a value for certain prompted columns.
As such, we have written a custom Javascript for a custom "Go" button on our dashboards. The JS validates the required fields and generates a Go URL which loads into an iFrame when the custom button is clicked. This works fine in Internet Explorer, but in Firefox the prompt values are not being passed into the Go URL string. This is a security risk as it shows all data on the report when it shouldn't for certain users. Can anyone look at the JS code below to see why it won't work in Firefox?
Thanks
removed code, sorryEdited by: odinsride on Feb 10, 2011 9:17 AM

if(navigator.appName == 'Microsoft Internet Explorer')That would be the reason your code doesn't work in Firefox - most of it is inside an IE-only if clause!
Surely there must be a better way to achieve your requirement rather than to use all that javascript. One technique I've used to force a user to make a prompt selection is to use nonsensical default values on your prompts. By doing this you are guaranteed that the report will give 'no results' when it is first run. You can then add a no results view to the report and add your own custom message saying 'please make some selections from the prompts above'.

Similar Messages

  • Math.min JavaScript help needed

    Hello,
    I am trying to write a script for a fillable PDF in Adobe Acrobat, but I don't have much experience with JavaScript and I need some help!
    Basically I have three fields as follows:
    A1 = a field with a number value in it
    B1 = a field with a number value in it
    C1 = a field where the sum calculation will be.
    I want to write a script that will enter the lesser of the values in A1 and B1 into C1. If no value has been entered into B1, then it enters the value of A1 into C1.
    This is what I have come up with so far:
        // Get the field values, number fields as numbers
        var d1 = getField("A1").value;
        var d2 = +getField("B1").value;
        // Set the field value to either A1 or B1, whichever is lesser
         event.value = Math.min(d1,d2);
    Some of the problems with the script so far are:
    It does not calculate correctly if there is no value entered in B1 (should give just A1).
    It doesn't update the event.value if A1 is changed (until another form field is modified)
    Can anyone help??
    Thanks!

    Adjusted the field calculation order fixed question 2.
    The script given as answer worked great except for one area.
    B1 values can range from 0 and up. If a 0 is entered in B1, then the Math.min ignores it since d2=="".
    I can get around that problem by having a default value set in B1 of -1 (outside of the range). I'd prefer that there not be a default value set.
    Any suggestions? I appreciate the help.

  • If/then JavaScript help needed

    Hello,
    I am trying to write a script for a fillable PDF in Adobe Acrobat, but I don't have much experience with JavaScript and I need some help!
    Basically I have five fields as follows:
    A1 = a checkbox
    B1 = a field with a number value in it
    C1 = a field with a number value in it
    D1 = a field with a number value in it
    E1 = a field where the sum calculation will be.
    I want to write a script that will enter the sum of values of B1+C1+D1 into E1 if the checkbox in A1 is checked yes.
    If it is not checked yes, then it will enter the sum of values of B1+C1+ the value of D1 divided by 2 (and rounded down) into E1.
    Can anyone help??
    Thanks!

    This should do it as the custom Calculate script for E1:
    // Custom calculate script
    (function () {
        // Get the field values, number fields as numbers
        var a1 = getField("A1").value;
        var b1 = +getField("B1").value;
        var c1 = +getField("C1").value;
        var d1 = +getField("D1").value;
        // Set this field (E1) value based on the state of the check box
        if (a1 === "Off") {
            event.value = b1 + c1 + d1;
        } else {
            event.value = b1 + c1 + Math.floor(d1 / 2);

  • Javascript Help Needed Again

    Hi there, I am not very good with Javascript, so was looking
    for some help.
    I have a select list for an order checkout page, which is
    basically how
    people heard about the site. You select one, and depending on
    what it
    is, another form field will appear with a message asking for
    more detail.
    For instance, if they selected Search Engine, another field
    would appear
    with the text "Which search engine" and a form field for them
    to enter
    it into.
    What is the best way to do this? Some of the options in the
    select list
    won't need the additional field.
    Cheers,
    Steve

    Dooza wrote:
    > Dooza wrote:
    >> Hi there, I am not very good with Javascript, so was
    looking for some
    >> help.
    >>
    >> I have a select list for an order checkout page,
    which is basically
    >> how people heard about the site. You select one, and
    depending on what
    >> it is, another form field will appear with a message
    asking for more
    >> detail.
    >>
    >> For instance, if they selected Search Engine,
    another field would
    >> appear with the text "Which search engine" and a
    form field for them
    >> to enter it into.
    >>
    >> What is the best way to do this? Some of the options
    in the select
    >> list won't need the additional field.
    >
    > Ok, I have almost got this sussed, just need some syntax
    help :)
    >
    > function toggleElement(sel1, element1) {
    >
    > element1 = document.cart.elements[element1];
    > //alert(element1.value);
    > if (sel1.value == 'searchenginelisting') {
    > element1.value = 'Which search engine?';
    > element1.style.display = 'inline';
    > }
    > if (sel1.value == 'searchenginesponsored') {
    > element1.value = 'Which search engine?';
    > element1.style.display = 'inline';
    > }
    > if (sel1.value == 'banner') {
    > element1.value = 'Which website?';
    > element1.style.display = 'inline';
    > }
    > else {
    > element1.value = ''; // input text will be empty
    > element1.style.display = 'none'; // hide text element
    > }
    > return;
    > }
    >
    > It currently only works when you select banner from the
    select list.
    > When you select the first 2 it does nothing. Its the way
    its nesting the
    > IFs, can anyone tell me how to sort this out?
    >
    > Cheers,
    >
    > Steve
    function toggleElement(sel1, element1) {
    var element1 = form.elements[element1];
    if (sel1.value == 'searchenginelisting' ||
    sel1.value == 'searchenginesponsored'){
    element1.value = 'Which search engine?';
    element1.style.display = '';
    return;
    if (sel1.value == 'banner') {
    element1.value = 'Which website?';
    element1.style.display = '';
    return;
    element1.value = ''; // input text will be empty
    element1.style.display = 'none'; // hide text element
    Mick

  • Javascript Help Needed to Show/Hide Regions

    version 4.0.2.00.07
    Hello,
    I'm hoping that someone would help me with creating a Javascript function to Show/Hide regions.
    I have a Select List defined as Checkboxes that when clicked I would like to show specific regions that contain fields that are specific to that checkbox selection. There are currently four selections available. There are two selections that would show one region and the other two selections would show the other region.
    Please let me know if I need to clarify anything.
    Thanks,
    Joe

    There is an out-of-box solution that may help you - check out the "Customisation" section in the region properties.
    Otherwise, you might like to explore using a Dynamic Action to show/hide your region based on an event on your relevant checkbox.
    Either way, you should have a declarative solution when you thought you might need to hand-code some javaScript :-)
    ps - thanks for providing your Apex version.

  • Javascript help needed (confirmation for cancel button )

    Hi guys!
    I am not good at javascript but am going to improve shortly :-). Now i need very quick fix.
    I'm using <html:cancel> button in Struts 1.1 and I'm using without thinking the following code:
    <html:cancel onclick="bCancel=true;" >
    <bean:message key="cancel.operation"/>
    </html:cancel>
    It is not that important though. I would like very much to alert user on possible loss of data (long multipaged form - could press mistakingly, who knows).
    Would you, please post the javascript code that is needed to accomplish this - just alert and if yes - cancel, no - leave alone?
    I'll really appreciate this.

    Thank you for your response.
    I also manage to write this. Is this correct?
    <script language="JavaScript">
    function ensure() {
    return confirm("Are you sure that you want to cancel this operation?");
    </script>
    <td colspan="3" align="center">
    <html:cancel onclick="bCancel=ensure();" >
    <bean:message key="cancel.operation"/>
    </html:cancel>
    </td>

  • Images with hyperlink in javascript - help needed

    Hai,
    I am having two hyperlinks say, "Good Morning" and "Good Evening". When I am clicking "Good Morning", a small arrow or a picture should display with the hyperlink.
    When I am clicking "Good Evening" this one should have the small arrow or a picture and "Good Morning" will be displayed normally (without picture).
    How can I do this using javascript?
    Did anyone has the code? Pls help me.
    <html>
    <head>
    <title>
    Moves the Arrow When Clicked the Headings for Sorting purpose
    </title>
    <SCRIPT language="JavaScript">
    function remove_picture() {
    function set_picture() {
    </SCRIPT>
    </head>
    <body bgcolor="peachpuff" width="90%" align="center">
    <table>
    <tr>
    <td align="left">Good Morning</td>
    <td>Good Evening</td>
    </tr>
    </table>
    </body>
    </html>
    - yogee

    <html>
      <head>
        <style type="text/css">
          #notclicking .highliter {
            display: none;
          #clicking .highliter {
            display: inline;
        </style>
        <script type="text/javascript">
          function showHighliter(elem) {
            elem.id="clicking";
          function hideHighliter(elem) {
            elem.id="notclicking";
        </script>
      </head>
      <body>
        <a href="#" id="notclicking"
           onfocus="showHighliter(this);"
           onblur="hideHighliter(this)">
          <img border="0" class="highliter"
               src="http://forum.java.sun.com/im/duke.gif"/>
          Good Morning
        </a><br/>
        <a href="#" id="notclicking"
           onfocus="showHighliter(this);"
           onblur="hideHighliter(this)">
          <img border="0" class="highliter"
               src="http://forum.java.sun.com/im/duke.gif"/>
          Good Evening
        </a><br/>
      </body>
    </html>

  • Javascript help needed if possible

    I am trying to combine code from codaslider and shadowbox, but whatever I try, my code is basically rubbish!!
    I want to combine the following two links in to one:
    <a rel="shadowbox[Mixed];width=640;height=360" href="#">
    <a class="xtrig" href="#1" rel="coda-slider-3">
    I am fairly certain that all I need to do is combine the two 'rel=' parts of the code to get it working. Basically, what I am trying to do is stop codaslider from sliding when I click and instigate the shadow box. Is it possible?
    TIA
    Mat

    No, it can't be done. JSP code runs before the HTML page is generated; it's a server side technology. JavaScript runs on the client's machine, after the page has been rendered.

  • Help need to script(urgent)

    hai everybody...
    i ahve written a javascript for popup a new
    window...this is my script
    script
    function open()
    if(portal40.wwctx_api.get_user=='JAYANTHAN')
    window.open('http://suntechchn:7777/pls/portal40/ATCMIS.ENQUIRY_REP.show?p_arg_names=_show_header&p_arg_values=YES&p_arg_names=_max_rows&p_arg_values=25&p_arg_names=_portal_max_row s&p_arg_values=25','new_page','width=1500,height=550,scrollbars=yes');
    else
    window.open('http://suntechchn:7777/pls/portal40/ATCMIS.ENQ_REPORT.show?p_arg_names=_show_header&p_arg_values=YES&p_arg_names=_max_rows&p_arg_values=25&p_arg_names=_portal_max_rows &p_arg_values=25','new_page','width=1000,height=950,scrollbars=yes');
    open();
    but it doesn't open the new window...
    for this i have created two reports,the above links are the report links...if it satisfy the condition then the first link lead to the
    first report if not then second report
    please help need ....
    thansk in advance
    leena
    null

    This example will read and put the Authors name to the ESTK console and write the new details back to the document.
    #target bridge
    loadXMPLibrary();
    var thumb = app.document.selections[0];
    if(thumb.hasMetadata){
            var selectedFile = thumb.spec;
      var myXmpFile = new XMPFile( selectedFile.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
      var myXmp = myXmpFile.getXMP();   
      var arrItem='';
      var items = myXmp.countArrayItems(XMPConst.NS_DC, "creator");
       for(var i = 1;i <= items;i++){
    arrItem += myXmp.getArrayItem(XMPConst.NS_DC,  "creator", i);          
        $.writeln(arrItem);
    var Author = "This is my new Author";
    myXmp.deleteProperty(XMPConst.NS_DC, "creator");
    myXmp.appendArrayItem(XMPConst.NS_DC, "creator", Author, 0,XMPConst.ARRAY_IS_ORDERED);
    if (myXmpFile.canPutXMP(myXmp)) {
        myXmpFile.putXMP(myXmp);
             myXmpFile.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
    unloadXMPLibrary();
    function loadXMPLib(){
    if (ExternalObject.AdobeXMPScript == undefined) {
        ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
    function unloadXMPLib(){
       if( ExternalObject.AdobeXMPScript ) {
          try{
             ExternalObject.AdobeXMPScript.unload();
             ExternalObject.AdobeXMPScript = undefined;
          }catch (e){ }

  • Javascript Help Please

    I want to be able to have a combo box to automatically populate a field with a certain phrase or number. I dont know javascript and need some help.
    For example, in "combo box 1"- Cats, Dogs, Hamsters, Fish
    If I chose Cats, "Text1" field should populate "25,000"
    If I chose Dogs, "Text1" field should populate "10,000"
    I know this is a simple custom calculation but still need assistance
    Thanks

    The easiest way is to set the export value of each combo box item to the corresponding numeric value. The calculation simply sets the value of the field to the value of the combo box. In JavaScript, this would be:
    event.value = getField("combo box 1").value;
    If you don't want to set export values fro the combo box items, the custom calculation script could look like:
    (function () {
        // Object to associate combo box items with numbers
        var oVals = {
            "Cats" : "25,000",
            "Dogs" : "10,000",
            "Birds" : "15,000"
        // Set this field value to number associated with item, or blank if missing
        event.value = oVals[getField("combo box 1").value] || "";

  • Little help needed regarding http and https

    Hi,
    I maintain a website for my organization. Recently, for a login page, I started using HTTPS. It works fine with HTTPS.
    The problem I face is : When a user goes to login page, he sees the login page via HTTPS. Now, if user doesn't submit the login form but chooses to browse some other link on the same page, that page will still be shown using HTTPS because links are relative. This increases unnecessary HTTPS traffic on the server.
    I need a solution that can help me to change protocol back to HTTP if the user doesn't submit login form. I have written small piece of java script that can check at the time of leaving the page. If submit button wasn't pressed, it should change the protocol back to HTTP. I have played around window.location object trying to change it's href property. But, no luck yet. Please help me.
    window.onunload = function()
    // if submit button wasn't pressed, change the protocol back to HTTP          
              if (!submitPressed)
                        window.location.protocol="http:";
                        alert(windows.location.href);
                     window.location.port = "80";
            }Please let me know if you know about some simple solution.
    Edited by: Di_Ke on Nov 13, 2007 2:12 PM
    Edited by: Di_Ke on Nov 13, 2007 2:14 PM

    Just to clarify, before anyone can answer: Do you have access to the web server settings, and are you looking for a server side solution for this problem? If the answer to any of those two question is no, and you are just looking for a javascript help, this forums is not the best source for answers.

  • Javascript Help - Customising buttons to display varied data

    Hi there,
    I'm looking for some Javascripting help since I'm new to this form of scripting. In the report template I'm creating, I need to have a series of radio buttons with each being able to display a different amount of data when selected. So for example, if you choose option a and hit the select button: one layout for the document is shown, option b: another different layout would display, etc.
    Here's a link to an existing pdf which demonstrates what I'm looking for in the second half of the page. The pdf is locked so I can't look at the existing coding or anything that they've used. Any help would be greatly appreciated~ Thanks.
    http://www.lands.nsw.gov.au/_media/lands/pdf/rp_dealings_interactive/01T_v3-2.pdf

    Nariko,
    Place your "different amounts of data" in their own subforms. Have each subform default as hidden so that they won't show. Next in the change event for the radio button group place the following javascript (this assumes your radio button group has it's values bound as 1, 2, & 3):
    if(this.rawValue == 1)
    subForm1.presence = "visible";
    subForm2.presence = "hidden";
    subForm3.presence = "hidden";
    else if(this.rawValue == 2)
    subForm2.presence = "visible";
    subForm1.presence = "hidden";
    subForm3.presence = "hidden";
    else if(this.rawValue == 3)
    subForm3.presence = "visible";
    subForm1.presence = "hidden";
    subForm2.presence = "hidden";
    This will display and hide the objects in the various sub forms based on which radio button is selected.

  • Troubleshoting help needed:  My iMac keeps crashing and restarting with a report detail: "spinlock application timed out"  What can I do to fix this?timed out"

    Troubleshooting help needed:  My iMac keeps crashing and restarting with a notice: "Spinlock application timed out"  What can I do?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the page that opens.
    Select the most recent panic log under System Diagnostic Reports. Post the contents — the text, please, not a screenshot. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header and body of the report, if it’s present (it may not be.) Please don't post shutdownStall, spin, or hang reports.

  • Help needed for writing query

    help needed for writing query
    i have the following tables(with data) as mentioned below
    FK*-foregin key (SUBJECTS)
    FK**-foregin key (COMBINATION)
    1)SUBJECTS(table name)     
    SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
    2           02           Computer Science
    3           03           Physics
    4           04           Chemistry
    5           05           Mathematics
    7           07           Commerce
    8           08           Computer Applications
    9           09           Biology
    2)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
    383           S1      9           4           2           3
    384           S2      4           2           5           3
    ---------I actually designed the ABOVE table also like this
    3) a)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
    383           S1
    384           S2
    b)COMBINATION_DET
    COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
    1               383          9
    2               383          4
    3               383          2
    4               383          3
    5               384          4
    6               384          2          
    7               384          5
    8               384          3
    Business rule: a combination consists of a maximum of 4 subjects (must contain)
    and the user is less relevant to a COMB_NAME(name of combinations) but user need
    the subjects contained in combinations
    i need the following output
    COMB_ID COMB_NAME SUBJECT1 SUBJECT2      SUBJECT3      SUBJECT4
    383     S1     Biology Chemistry      Computer Science Physics
    384     S2     Chemistry Computer Science Mathematics Physics
    or even this is enough(what i actually needed)
    COMB_ID     subjects
    383           Biology,Chemistry,Computer Science,Physics
    384           Chemistry,Computer Science,Mathematics,Physics
    you can use any of the COMBINATION table(either (2) or (3))
    and i want to know
    1)which design is good in this case
    (i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
    good method to link with same table but if 4 subjects only(and must) comes
    detail table is not neccessary )
    now i am achieving the result by program-coding in C# after getting the rows from oracle
    i am using oracle 9i (also ODP.NET)
    i want to know how can i get the result in the stored procedure itsef.
    2)how it could be designed in any other way.
    any help/suggestion is welcome
    thanks for your time --Pradeesh

    Well I forgot the table-alias, here now with:
    SELECT C.COMB_ID
    , C.COMB_NAME
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
    FROM COMBINATION C;
    As you need exactly 4 subjects, the columns-solution is just fine I would say.

  • Help needed I have a canon 40D. I am thinking of buying a canon 6D.But not sure that my len

    Hi all help needed I have a canon 40D. I am thinking of buying a canon 6D.
    But not sure that my lenses will work.
    I have a 170mm/ 500mm APO Sigma.
    A 10/20 ex  Sigma   HSM  IF.
    And a 180 APO Sigma Macro or do I have to scrap them and buy others.
    ALL Help will be greatly received. Yours  BRODIE

    In short, I love it. I was going to buy the 5DMark III. After playing with it for a while at my local Fry's store where they put 5DMII, 5DMIII and 6D next to each other, using the same 24-105L lens, I decided to get the 6D and pocket the different for lens later.
    I'm upgrading from the 30D. So I think you'll love it. It's a great camera. I have used 5DMII extensively before (borrowing from a close friend).
    Funny thing is at first I don't really care about the GPS and Wifi much. I thought they're just marketing-gimmick. But once you have it, it is actually really fun and helpful. For example, I can place the 6D on a long "monopod", then use the app on the phone to control the camera to get some unique perspective on some scenes. It's fun and great. GPS is also nice for travel guy like me.
    Weekend Travelers Blog | Eastern Sierra Fall Color Guide

Maybe you are looking for

  • HP Officejet Pro 8600 Plus (UK purchase) will not connect to wired ethernet network

    Hi We have an HP Officejet Pro 8600 Plus (purchase here in UK approx 9-12 months ago) which has sort of worked OK wirelessly but finance industry compliance requirements now require me to connect to it by normal ethernet cable.  When I disable wirele

  • Running a time machine back-up of a HD in target mode

    Hi guys Wondering if anyone can offer me some advice. My macbook pro won't start up and gets stuck in grey screen with apple logo. I have tried various troubleshooting tips as per apple support documents but cannot get it to start. Before I get to in

  • My legal copy will not activate because I used it on a computer which crashed, I got a new hard etc.

    I have a legal coopy of Elements 9.  I installed it on an older computer which crashed.  A new hard drive was installed and I re-intalled Elements.  Shortly afterward, the motherboard and processor  had to be replaced and a new hard drive was also in

  • Multi Monitor outputs

    Can anyone suggest how i can do this please.... I have a dual 19" LCD monitor setup with my Dual G5 2Ghz. I want to put another LCD monitor in another room about 10 Metres away, so my artists can see the Logic arrange page ( So they can see the in/ou

  • New Camera Raw update 5.02

    Adds support for: Nikon D5300 Nikon Df Olympus OM-D E-M1 Sony Alpha 7 Sony Alpha 7R And yes, we know already that Apple are late and you're moving to Lightroom and we know already that they still haven't added support for your camera and all the usua