Javascript on button item

Hi, created a very simple (two column) report based on pl/sql. Under edit page, html header added a javascript function that will opens the my report on a new popup window. NOW, I created a button on my page with style of HTML Button. By pressing this button I like to call that javascript to open my report. But each time I press this button it acts as submit button. If I create an url it works but I like to do this with button. Where can I palce my call to javascript?
thanks for your help
-iahmadi

Hi:
It appears that you have created a button that is 'displayed among this region's items'. AFAIK ,this kind of button , when clicked, submits the page unconditionally. Drop this button and create the button as a 'region button' (Create a button in a region position).
Varad

Similar Messages

  • Button Item and JavaScript

    Hi everyone
    I am trying to execute a Javascript function when a button item is pressed. This javascript execute a doSubmit() in order to called a branch of the page.
    I tryed to make this using this code, first in a branch (PL/SQL) and then in a PL/SQL process, but did not work, "chkSubmit(false)" function is not being called.
    begin
    htp.init;
    htp.p('<script language = "javascript">');
    htp.p('<!-'||'- Comment out script for old browsers');
    htp.p('function callFunction()');
    htp.p('{');
    htp.p(' chkSubmit(false);');
    htp.p('}');
    htp.p('callFunction();');
    htp.p('-'||'->');
    htp.p('</script>');
    end;
    Does anybody knows how can I fixed this problem?
    Thanks in advance
    Andrés

    Instead of fighting it, what I end up doing is just
    create a plain HTML button in the Post Element Text
    of the previous item and put my function there
    <input type="button" class="..." value="Click me!" onClick="foo()" />A tip for using "Post Element" buttons:
    Check out the HTML that gets generated using "View Source" in your browser
    (in Firefox, that's Ctrl-U).   The biggest problem is getting the display right. 
    The HTML generated uses <td> <label> and <span> elements, so a simple
       <input type="button" value="Add Filter" onClick="somefunc()">
    looks bloody awful.  You need a bit more to make it line up nicely.
    Here's what I have for a button that displays at the end of a row of region items,
    each of which has its label above it:
    <td  colspan="1" rowspan="1" align="left">
      <label for="P1_foo" tabindex="999">
        <span class="t10OptionalLabel">foo label</span>
      </label>
      <br><input type="button" id="P1_foo" value="foo" onClick="alert('foo!');">
    </td>
    You might be using a different template and/or layout than I am, so DO go to the
    browser and figure out what HTML is being generated.  If you don't want the label,
    substitute " " for "foo label" in the example above.  It's a snap from there.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Executing Javascript with button

    How can I go about executing javascript with an item level button?
    In the HTML DB 2 day tutorial it says this:
    Calling a JavaScript from a button is a great way to confirm a request. Oracle HTML
    DB actually uses this technique for the delete operation of most objects. For example,
    when you delete a button, a JavaScript Alert Box appears asking you to confirm your
    request. Consider the following example:
    <script language="JavaScript1.1" type="text/javascript">
    function deleteConfirm(msg)
    var confDel = msg;
    if(confDel ==null)
    confDel= confirm("Would you like to perform this delete action?");
    else
    confDel= confirm(msg);
    if (confDel== true)
    doSubmit('Delete');
    </script>
    This example creates a function to confirm a delete action and then calls that function
    from a button. Note that the function optionally submits the page and sets the value of
    the internal variable :REQUEST to "Delete," thus performing the delete using a process
    that conditionally executes based on the value of request.
    Note that when you create the button you would need to select the Action Redirect to
    URL without submitting page . Then, you would specify a URL target such as the
    following:
    javascript:confirmDelete('Would you like to perform this delete action?');
    Can I only do this from a region button?

    hi,
    I have created a javascript form validation and finally (if its passes the validation) I am setting the :REQUEST as doSubmit('GO');
    I am calling a conditional process with condition as request = expression1
    with expression 1 as GO.
    The javascript is as follows
    function message_name_not_null(){
    if(document.getElementById('P14_MESSAGE_NAME').value.length==0)
    alert("Message Name is Mandatory!!");
    return;
    else if(document.getElementById('P14_MESSAGE_TEXT').value.length==0)
    alert("Message Text is Mandatory!!");
    return;
    else
    doSubmit('GO');
    My problem is my process is not getting called in button click(I have called the javascript from this button as javascript:message_name_not_null(); in Optional URL Redirect section)
    I have specified the :REQUEST value in the branches also.
    Any sort of help please..
    Thanks in Advance
    Kaushik

  • Button Item to open a popup window  but not do a submit

    Hi,
    I want to open a popup using a button that is next to an item. I do not want a submit to occur.
    I've followed the directions in Want Button Item to call popup window and the popup displays correctly.
    However it also does a submit.
    How to do I prevent the submit when this button item is pressed?

    I copied the Button templates, called it "Javascript Button", and changed its code from:
    <table class="t15Button" cellspacing="0" cellpadding="0" border="0"  summary=""><tr>
    <td class="t15L"><img src="#IMAGE_PREFIX#themes/theme_15/button-l.gif" alt="" /></td>
    <td class="t15C"><a href="#LINK#">#LABEL#</a></td>
    <td class="t15R"><img src="#IMAGE_PREFIX#themes/theme_15/button-r.gif" alt="" /></td>
    </tr></table>to:
    <table class="t15Button" cellspacing="0" cellpadding="0" border="0"  summary=""><tr>
    <td class="t15L"><img src="#IMAGE_PREFIX#themes/theme_15/button-l.gif" alt="" /></td>
    <td class="t15C"><a href="AAAAA">#LABEL#</a></td>
    <td class="t15R"><img src="#IMAGE_PREFIX#themes/theme_15/button-r.gif" alt="" /></td>
    </tr></table>where "AAAAA" is "javascript:#BUTTON_ATTRIBUTES#" (the markup wasn't working so I had to describe it this way).
    I then put the script I want to execute in the Button Attributes and made the Request whatever. It's not very elegant but it does work.

  • Custom icon for bar button item on iPhone?

    Hey all,
    I'm trying to set a custom image as a bar button item in my iPhone app and can't figure it out. I don't want the image inside a button, I want the image to be the button itself. If I use initWithCustomView the area isn't clickable anymore (unless I'm missing something).
    Does anyone know how to do this?
    Thanks,
    Mike O.

    I am having the exact same problem, but I cannot figure out the solution. I tried initWithCustomView: with a UIImageView, and then with a UIButton. If I set the UIBarButtonItem's target and action, that method does NOT get called in either scenario, and when i set the UIButton's target and action in the latter scenario, it STILL does not get called. Could you post your working sample code? Here is an example of my code which DOES NOT WORK!
    UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setImage:[UIImage imageNamed:@"NowPlaying.png"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(nowPlayingButtonClicked) forControlEvents:UIControlEventTouchUpInside];
    nowPlaying = [[UIBarButtonItem alloc] initWithCustomView:button];
    nowPlaying.action = @selector(nowPlayingButtonClicked);
    nowPlaying.target = self;
    Thanks for your help.
    Message was edited by: Ben Sussman

  • Customize look of javascript disabled page items

    I'm using javascript to enable and disable text field items on a page based on the user's access level and role. I chose to use a script for this because every item on the page is affected, and it seemed easier to maintain and debug by collecting all the logic together. This is working great, however it isn't looking so great. The background and text colors are both grayish and the end result looks like an etch into metal plating. What I would like is for the javascript disable function to look like when I disable it through APEX, a white background text field with grayed text. How can I customize the disabled look?

    OK so I've tried your guys' suggestions and here are the results along with some more info.
    It looks like APEX sets the attributes for items that are "Disabled, does not save state" as disabled="disabled", but "Disabled, saves state" as readonly="readonly". Not a big deal, I can just fix both styles. However, the problem is the javascript disable function seems to be overriding the CSS style.
    My javascript function enableDisableItems() is run onload and has a bunch of lines that conditionally run $x_disableItem('P801_MY_ITEM',true); If I don't run enableDisableItems, I can see my CSS styles. But, if I do run it, the styles go away and I'm left with the old metallic look again. I'm guessing that not only does the javascript change the items' state, but also style. I don't understand why it's doing that or how to stop it...

  • What is the code to get the  Label of  radio button item at runtime?

    Hi All
    I am working on forms 10g(version 10.1.2.0.2 ) with Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 on windows 2000 platform.
    My requirement is to dynamically get the label of the radio button item in a radio group.I am able to get the label of the radio group as shown below
    Item :Radio group
    Label : Gender
    IF m_type = 'RADIO GROUP' THEN
         m_label:=Get_Item_Property(m_Item ,label);
    END IF;
    There two Radio buttons inside this radio group which are
    item     : Radio button
    Label : Male
    item :Radio button
    Label :female
    What is the code to get the label of radio button(i.e) male and female ?
    How will I get the count of radio buttons in a radio group at runtime?
    Regards
    Mohan

    But you have to provide the button name which cannot be get at runtime.
    This is a lack of information that the Dev team would correct !
    Francois

  • Cannot create additional Radio Button items

    Hi. I am new to Appleworks database, so this my be a stupid question. When I try to add a field and define it as a radio button group, then try to customize the buttons via Options, it normally only shows 2 buttons "Item 1" and "Item 2". I can modify these 2 buttons, but cannot create any other buttons or delete either of these buttons. The "Create" button is greyed out when in Options. I tried re-installing Appleworks with no change.

    Adding to the previous comments:
    You can't delete either of the two items because two is the minimum number of items for a radio button field. The purpose of radio buttons is to allow a choice between (or among) items.
    When you click on either item in the list (and make no change to its label) AppleWorks offers you only the choice to modify it because it won't allow two items with the same label. When you change the label, AppleWorks offers the choice of Modifying the existing button or Creating a new button with the label/item name you've typed into the box.
    Once you've created an additional button it's possible to delete a button without leaving fewer than the minimum two buttons in the field, so AW then adds Delete to the available choices.
    Regards,
    Barry

  • Need to create OAF new Button Item with Destination URI with dynamic value

    Would like to add a personalization to a OAF page, with adding a new button Item. Behind the button item, one of the properties we would like to set is Destination URI, and we would like to have this with a dynamic value from the Page we are on.
    Let's say we are on the OAF page for customers. One of the fields is Customer Account Number. This is one of the Attributes from the View Object that the page is built on. So we want to take a value from an Attribute, and use this in the Destination URI value. That is what I mean by dynamic. It depends on what record from the database we are looking at on the OAF page.
    In this case it is View Object is 'HzPuiCrUpCustActVO' and the Attribute is 'AccountNumber'
    Does that make sense? can we reference an View Attribute value in the Destination URI? How can this be done?
    Thanks!

    Kristofer,
    This does make it clearer, as far as using the personalization property to reach another OAF page.
    I would like to build a custom page for the destination, but I did not want to necessarily the page to be another OAF/jsp page.
    One thing we might want to do is build an APEX page. so this Destination URI might have to start with something like http://oraserver.mycompany.com:7779/pls/apex/f?p=
    Another option we might want to use is to just have the destination resolve to a custom URL that includes a parameter value like http://mycompany.com/1905 where 1905 is the account number from the Customer Account OAF page.
    Any ideas, or is this even possible?
    Chris

  • Submit data using Jquery/Javascript during button click

    submit data using Jquery/Javascript during button click

    Hi,
    From your description, my understanding is that you want to restrict edit form with jQuery/JS.
    If you want to restrict the default edit form with jQuery/JS, you could refer to these steps below:
    Enter your editform.aspx.
    Add below code under <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">.
    Save this file.
    <script src="https://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    function PreSaveAction(){
    if($("select[id$='DropDownChoice']").val()==""){
    alert("please choose a value!");
    return false;
    return true;
    </script>
    The screenshot below is my result(it will not save data after clicking OK in the message alert):
    If you customize your list with InfoPath, you could check the checkbox “Cannot be blank” under Validation section or add a rule for your validation as the screenshot below:
    In addition, you could check your code with pressing F12 to debug your code.
    Best Regards,
    Vincent Han
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Radio button item value from plsql

    Hi,
    I have a radio button with 3 options on a region (P3_RADIO1). With pressing a button I would like to check the value of P3_RADIO1. But in plsql :P3_RADIO1 is empty. How can I reach the selected return_value of then radio button item?
    A.

    Hi,
    Reasonable straightforward. You just need to use the bound values of the radio button (1 or 2):
    switch (this.rawValue)
        case "1":
        Response12BN.presence = "invisible";
        xfa.host.messageBox("Attach a copy of your company’s safety manual and safety incentive programs.",  "SAFETY PROGRAM ATTACHMENTS", 3, 1);
        break;
        case "2":
        Response12BN.presence = "visible";
        Response12BN.rawValue = xfa.host.response("Please enter the reason you do not have a Written Safety Program here", "WRITTEN SAFETY PROGRAM");
        break;
    Should work,
    Niall

  • Javascript on Button displayed among this region's items?

    Hello,
    I have implemented Javascripts to used manual LOV, has well describe in "How To", and everything work well.
    I now want to put a button in my LOV page to return back a fix value to the calling page/item. From this button, I'm calling the javascript javascript:passBack('fix_value');
    If I put this javascript in URL Target of a region button, it is working well.
    But position of the button is not what I want. If I try to use a "button among region items" and I define a branching with URL target equal to the same javascript, I get a page not found error.
    Is there an easy solution for this?
    Thank you
    Jean

    check out whether this helps you.....
    when we create a button then automatically javascript:doSubmit("request") function gets attached to it and in this function , current page is submitted.
    If you have created the button among the region items , then i am pretty much sure that you wanted to display this button adjacent to some item (let us say A ) in the region
    If above assumption is right then i think it is better to use a IMG tag (displaying the button ) in < Post Element Text > of item A instead of creating the button in the region...
    e.g then you can put the same in <Post Elment Text > of item A of the region
    <IMG SRC="img src"
    alt="Query" border="0" align="bottom left"
    onclick = "<call javascript>">
    here you can
    1. use HREF to redirect ....then no need of javascript function
    2. put "#" in HREF and use a javascript function to re-direct...
    i have used this approach extensively and it works fine ...plus it gives you freedom to exactly place the button where you wanted on ur page ...
    P.S. i tried creating doSubmit(request) function on the page and thought that this function might override the HTMLDB's doSubmit function ..but it did not work
    ----------------------------------------------------------

  • How to use javascript to access item VALUES on a portal form

    Hi,
    I want to pick up VALUE of an item on a portal form from the on click event of the save button. I know there is a way to acces the item name and assign a value to that item. For example,
    setItemValue(this.form,'UNIT_NAME', this.value)
    If I use this line of code then I get the value of the save button because I put this line of code in the on click event of the save button. Please help.
    Monique

    You can get hold of any field on your form as follows:
    document.forms[0].elements['<form>.DEFAULT.<field>.01']
    So for example to get (or set) a value in my form I have:
    document.forms[0].elements['REQUESTFRMEU.DEFAULT.BUS_OBJ.01'].value
    Note that setting a value of a field with Javascript on the Insert button's onclick event will not result in the new value being sent to the DB. I think it has to do with the values being set into a session object of sort and the DB gets updated from these values and when you update the field with JS it does not update thesee session values. If you set the value somewhere else (e.g. another event handler before the Insert button is clicked) you should be OK.
    Cheers.
    Anton.

  • How can assign the value returned from javascript to Hidden item

    Hi All,
    I have created a report with button in one column adding following code to SQL select statement like
    SELECT USER_RQST_ID, USER_RQST_DESC, RQST_DATE, STATUS, USER_ID, CNTRY_ID, KPI_LIST, YEAR_LIST, QTR_LIST, MONTH_LIST,
    PROD_LIST, FULL_PERIOD_FLG, GEN_DATE, '<input type=button value="view_list" onclick="javascript:doSubmit('||USER_RQST_ID||');">' button FROM KPI_USER_RQST;
    Then i have implemet doSubmit() function in Javascript like
    function doSubmit(req_id)
    html_GetElement('HIDDEN_ITEM')= req_id.value;
    Here HIDDEN_ITEM is the name of the item, I want to use that HIDDEN_ITEM value in PL/SQL block like...
    BEGIN
    INSERT INTO SAMPLE(KEY) VALUES(:HIDDEN_ITEM);
    END;
    But it is not working, Please help me anybody know the solution How to assign an item in javascript block function.
    Thanks,
    Neel

    Hello,
    doSubmit() is one of the built in javascript functions in apex and it's a bad idea to override it unless you know exactly what you are doing, and even then is a generally bad idea.
    change your function to this
    function mySubmit(pValue){
    $x('HIDDEN_ITEM').value = pValue;
    doSubmit();
    then your onclick will look like this notice the lack of the javascript: and the three ''' quotes to get the proper quotations for your value.
    onclick="mySubmit('''||USER_RQST_ID||''')"
    And there you go
    Carl

  • Javascript reference page items

    I have a popup window (page 3) in which a user chooses 3 values from seperate static select lists (hours, minutes, am/pm).
    I want these values to be returned into three seperate text fields on the page underneath (page 1). How do i reference them?
    At the moment I am using the following procedure in the header of the popup:
    <script language="JavaScript">
    function passBack(passVal1, passVal2, passVal3)
    opener.document.getElementById("P1_HOURS").value = passVal1;
    opener.document.getElementById("P1_MINUTES").value = passVal2;
    opener.document.getElementById("P1_AM").value = passVal3;
    close();
    </script>
    When i press a button, i have a URL redirect to:
    javascript:passBack('&P3_HOURS.','&P3_MINUTES.', '&P3_AM_PM.');
    should i be using the '&XXXX.' format here? I have used this exact procedure for a Report and used '#XXXX#' format and it worked perfectly.
    Please help, by tomorow if possible ;)
    Thank you,
    Scott

    Thanks heaps for you quick reply Patrick.
    I copy and pasted your code to my button, and no success. When i hover over the button, the bottom of the browser merely says
    "javascript:passBack($x("
    Not sure what i did wrong.
    I had another solution, to make all of the select lists into "select lists with submit", and then have each of them set the appropriate items on page 1.
    The items are set, but they do not appear until I manually refresh the page. So I need a button to refresh the page behind the popup, then close the popup (can close easily, but not sure on how to refresh?).
    Any help with either method would be a tremendous help,
    Thanks again,
    Scott

Maybe you are looking for