Button javascript dosubmit

hello,
i have a button that submits the page.
I want to show an alert box, if certain conditions are met ( for example, text box is empty ) and do NOT submit the page - redirect to this same page. If those conditions fail, then continue with doSubmit flow.
// I do know that this can be done using the validation tab, but i'm just curios how to implement this in javascript.
thank you.
Andrew

Andrew,
With Apex 4 this is supposed to become much easier. If you'd like to do it now it's a bit more work. You basically change the button to call a custom JavaScript process which will in turn call doSubmit if/when you want it to.
You do this by setting the button's Optional Redirect to URL and then putting something like the following in:
javascript:validateMyItems();Of course there'd have to be a function of that name to do the job. Warning - JavaScript validation should not replace server side validation - it should supplement it.
Regards,
Dan
http://danielmcghan.us
http://sourceforge.net/projects/tapigen
You can reward this reply by marking it as either Helpful or Correct ;-)

Similar Messages

  • Javascript:dosubmit  - error

    i have just build application.. and i don't know what happened every javascript:dosubmit button on page 1 give me an error
    look at picture
    http://img526.imageshack.us/img526/8498/47216945.jpg
    any suggestions?
    i can't build it again, please help :(

    check your after submit validations, computations, processes and branches for any select ... into ... statement. Also check if any of these call a procedure or function in which there may also be a select into statement.
    cheers,
    Jure

  • Buttons & Javascript

    Greetings,
    I have a PopUp (called by the popUp2() function) that I want to save and close immediately after saving by clicking an Enter Comment button. I have that working (with some help on the forum, thanks).
    The initial Enter Comment button is a region button with this in the URL Target:
    javascript:doSubmit('CREATE');window.close();
    This works perfectly.
    I want to move the button below an item, so I created a javascript button that executes a javascript function when clicked. The code for that button is:
    <input type="button" onclick="button_Action()" value="Enter Comment" />
    As you can see it calls the button_Action() function. This is the code for that function (which is in the HTML Header):
    <script>
    function button_Action(){  
    doSubmit('CREATE');
    window.close();
    </script>
    When I click the javascript button the window closes, but the page is not submitted (the comment isn't created). If I remove the window.close() the page is submitted and the comment entered, but the window doesn't close! Arrgh! :-)
    I'm stumped. Why does the javascript work differently when it is in a function as compared to being in the URL Target?
    Also, what do I need to do differently to get it to work the way I want?
    Thanks, Tony

    Hi Andy,
    Thanks for the info.
    Below is what I have in my PL/SQL, how does it look?
    BEGIN
    -- Closes this popup window.
    htp.p('<body>');
    htp.p('<script type="text/javascript">');
    htp.p('window.close();');
    htp.p('</script>');
    htp.p('</body>');
    END;
    There must be something wrong, because it doesn't close the window.
    I simply have it running after the DML process, it isn't even conditioned. It excutes after the page is submitted.
    Thanks, Tony

  • APEX 3.1.2 javaScript:doSubmit don't able navigate BUG

    Hi everybody,
    We're working with APEX 3.1.2.
    We're not able to navigate from page to page with the Thumbnails.
    It seems that the javaScript:doSubmit doesn't execute.
    In our example we want to go from 'Généralités' page to 'Paramètres' page:
    javaScript:doSubmit('T_PARAMÈTRE');
    Can you help me ?
    Thanks & Regards.
    Eric.

    HI everybody,
    I apologize, when I say ``Thumbnail`` it means ``Tabs``.
    Anybody had never get this bug yet ?
    Thanks & Regards.
    Eric.

  • The function javascript:doSubmit not passing variables between pages

    Hi,
    I have an report that has a link to another page, and I'm trying to pass 2 variables. If I use a target URL as such the variables do not get passed, but if I use a page target and explicitly add the item name and values it works fine. Here is the call I'm using to javascript:doSubmit:
    javascript:doSubmit('f?p=&APP_ID.:32:&SESSION.::&DEBUG.:32, CIR:P32_PROJ_ID,P32_DID:#AWARD_NUMBER#,#ID_PROVIDED#');
    Does anyone have any insights?
    Thanks,
    Joe

    You can't use doSubmit to pass variables; it will only submit your page with the request you passed in.  All normal page processing and branching will be followed..  Why are you using doSubmit?  Just put the URL in the URL field.
    f?p=&APP_ID.:32:&SESSION.::&DEBUG.:32, CIR:P32_PROJ_ID,P32_DID:#AWARD_NUMBER#,#ID_PROVIDED#

  • I click a box on a website and nothing happens. When I hover over the button "javascript:void(0); appears on the left"

    I click a box on a website and nothing happens. When I hover over the button "javascript:void(0); appears on the left"

    same issue

  • Javascript: doSubmit()

    I would like to do something like
    javascript:doSubmit('foo');alert('&ITEM.');
    There is a After Submit process (for request=foo) that calls a PL/SQL procedure and sets the value of :ITEM.
    It doesnt seem to be working. The page is submitted but the JS alert box is shown before the after submit process has completed, thus showing the incorrect (older) value of :ITEM
    Am I doing something wrong, is there another way to do this?
    Thanks

    html source. You could branch back to the same page
    and emit the same javascript to get an alert box with
    the submitted value. How can I do this? What would I put in the region/item source? I thought JS alert boxes only launched by user explicitly clicking something.
    Of course the alert would have to be in
    an item or region that was displayed
    conditionally based on whether it was a
    pre-submit or post-submit-and-branch rendering caseNot sure how I can do this either. Could you elaborate?
    The page is submited by doSubmit('foo'). The after submut process does its thing and sets the value of &ITEM.. The page has a branch back to itself. Now what?
    Thanks

  • Button, Javascript Confirm Box and Process

    I have a button on a page. When someone click on the button, depends on the value on a item, if it's not null, then pop up a confirmation box, if the item is null, the call a process directly. If the confimation is true, then call the same process, otherwise page won't be to submitted.
    I' m still on version 1.6.
    Anyone could give me some help?
    million thanks!
    Ran

    Thans for the reply.
    Here is what I did:
    I created another item called itemB. And put a javascript function on the HTML Header. And put a image button and use onclick to trigger the function. Based on the confirm is true or false, the javascript will set the itemB to two different values. And the process will run based on the value of the itemB. It seems to work sometimes, but not always. I don't know if I am missing anything or maybe it's not a right way to do it. Could someone take a look for me. Here is the javascipt.
    <script language="JavaScript" type="text/javascript">
    function checkMissing(formItem,formItem2)
    var t1 = document.getElementById(formItem).value;
    if (t1 != null)
      conmod = confirm("There is/missing parts, Do you wnat to continue to close the seesion?");
      if (conmod == true)
       document.getElementById(formItem2).value = "CLOSE";
       doSubmit();
      else if (conmod == false)
        document.getElementById(formItem2).value = 0;
      else
       document.getElementById(formItem2).value = "CLOSE";
       doSubmit();
    </script>

  • How to lock a form (all fields read only) using a button (JavaScript)

    Hi guys,
    I have a form with several input fields, check boxes. Using a button in the form, I would like to lock it using a JavaScript. Locking means in my case that all input fields, checkboxes, etc. are read only (cannot be changed anymore).
    I already use the following approach:
    data.form.MyInputField.access = "readOnly";
    The problem is, that this approach is not comforable from maintenance perspective. I would like a more generic or more simple way.
    Generic:
    loop over all fields and set them to "read only"
    Simple:
    xfa.form.lock; // but this does not work
    Do you have any ideas how to solve this requirement in another way as I currently do?
    Thanks,
    Thomas

    Now I used the following script:
    // set the whole form as container
    var objContainer = data.Report;
    // call the method to set all fields to read only (recursion)
    disableAllFields(objContainer);
    function disableAllFields(objContainer) {
         for (var i=0; i < objContainer.nodes.length; i++) {          
              switch (objContainer.nodes.item(i).className) {
                   case "field" :
                   case "exclGroup" :
                        objContainer.nodes.item(i).access = "readOnly";
                        break;
                   case "subform" :
                        disableAllFields(objContainer.nodes.item(i));
                        break;
                   default:
    It works but is there another possibilitiy such like
    form.lock;
    Thanks,
    Thomas

  • Need some help with button JavaScript for Save As event.

    Hi,
    I'm using Adobe Acrobat X Pro and am completely new to scripting forms in Adobe (completely new to Adobe Acrobat as well!).  On a form there is a save button that opens the Save As dialog by using a trigger (Mouse Up) and action (Execute a menu item - File>Save As...>PDF...) and this works fine, however, I want to now use javascript to modify this button's behavior so that is uses a trigger (Mouse Up) and action (Run a JavaScript), and I want that JavaScript to combine the text values from two form fields (a location Dropdown and a date Text field) and use this concateneated string + ".pdf" as the filename when it opens the Save As dialog.  Make sense?
    This is what I have added to the button as a JavaScript so far I am using a test string at the moment ("NewFile.pdf") and will add the concatenated string to the script after I know the script is working as it should.
    var newFileName = "NewFile.pdf";
    var pathArray = this.path.split("/");
    pathArray.pop();
    pathArray.push(newFileName);
    this.saveAs(pathArray.join("/"));
    Two issues so far:
    1. When I click the button nothing happens, no Save As dialog or anything. 
    2.When I check the button properties under the Actions tab the Select Action property shows "Execute a menu item" even though I previously selected "Execute a JavaScript"
    Thanks for any help!

    Thanks guys, I appreciate the response!  If I can bypass the Save As dialog and save the file to a default location using a file name that is contructed from two form field values then that would be perfect. I definitely think it is feasible to have a script file installed locally on each users workstation. I don't quite understand about folder-level security, etc. yet but am eager to learn how to do this stuff if you can give me gentle push in the right direction!  Thanks!

  • EMail Submit Button - Javascript warning

    On Friday, my distributed pdf worked perfectly. On Monday, when selecting the "Submit by eMail" button, it generates a javascript warning which then requires the user to fill out all of the senders email information and go through several warning screens. Previously, this only happened if there was no regular email client set up on that machine.
    What happened, and how can I find a solution? There were no modifications done to the file. I have tried to remake the form several times, and the javascript warning comes up each and every time on multiple machines.

    For some reason, I could not see that there was a response noted anywhere on the system, until I opened the original message. Is there an issue with the board? I just sent you the three files involved, via email.
    Thanks for your assistance.

  • Safari Pop up buttons / javascript

    I want to be able to select a specific item in a list of a pop up button in safari, i can do it by using a repeat statement and get value of button, with key codes simulating down arrow. This is tediously slow to the say the least. When i go view source of the page there is an identifier for the option i want, option value="f724". Is there a way to set the value of the pop up button to this number, i cant seem to do it. I was reading around the forum and found some mentions of the term do javascript but i have no idea how to implement it in this case, or if it at least possible.

    My search_replace(x, y, z) subroutine was a very basic attempt at encoding the URL properly. As it happens omitting the handler entirely and just setting keyword to text returned of result works the same in this case. The spaces get replaced with %20 by default, and the Discussions search app doesn't seem to mind.
    This style of search & replace is known as a "text item delimiters" or TIDs for short. You may have heard of a tab-delimited file. These contain cells of information separated by tabs. In the case of AppleScript's text item delimiter, we can set it to tab or any other character, and then ask for a string's "text items" provided in list form. So the steps taken by the handler in pseudo code are:
    1. Pass the text returned of the display dialog command to the search_replace handler, along with the search string "space" and the replace string "+"
    result: {"yellow fever", space, "+"}
    2. save whatever the current value of text item delimiters is
    This is to avoid potential conflicts with other code that may be using the delimiters property.
    result: {"[… anything]", ""}
    3. change the value of text item delimiters to space
    By defining " " (space) as a delimiter, we are effectively stripping every occurrence of the space character out of our string. This is because it can now be seen as a special delimiter character, as opposed to a literal one.
    4. get the text items of our string as a list
    result: {"yellow", "fever"}
    5. change the value of text item delimiters to the + symbol
    While our text string is a list, we are going to be sneaky and change the delimiter property from space to plus sign, like the one found in our original URL at Apple Discussions.
    6. coerce the list of text items back to a string
    When AppleScript coerces a list into a string, it automatically inserts the delimiter character you have defined in between each item.
    result: "yellow+fever"
    7. set the delimiter back to the way we found it in step 2
    The way I've written all this in actual code is highly abbreviated. To help read it easier remember that I'm addressing a reference to the delimiters, so every time you see the word "contents," that is referring to the text item delimiters. Also note that
    set {a, b} to {"a", "b"}
    is the same thing as
    set a to "a"
    set b to "b"
    The only difference is that the former is written in one line, and the latter is written on two lines.

  • Flash button  & javascript help

    I had a site up for quite a while and then one day it stopped
    working - had designed it a specific size - so had an
    intro page. On that page is
    the function
    function NewWindow(url, windowName, w, h, scroll) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops =
    'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable';
    win = window.open(url, windowName, winprops);
    if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
    In the SWF file the button that says enter has the following
    code:
    on (release){
    getURL("javascript:NewWindow("eyeconography.html","eyeconography","800","550","no")");
    Everything worked for years - and then one day did not in any
    browser (I think). This was not the only button effected.
    Thanks in advance for any help.

    Thanks for checking it out - I have a PC at work and the
    pop-up menu works on that computer, But It stopped on Macs - so now
    I think it is some security issue. I dont' know anything about the
    param name allowScripts, but maybe it has to do with that. I was
    wondering if anyone knows something that could have changed that
    would have suddenly changed the functionality of that button on
    Macs.

  • Radio Button  javascript onclick  show hide textbox

    Currently, if the radio button is clicked then text box is
    shown else if radio button 2 is clicked then textbox is invisible.
    (only one textbox being shown or being hidden)
    I wish to have 2 text boxes
    If radio button 1 is clicked then textbox1 is visible
    If radio button 2 is clicked then textbox2 is visible.
    What changes do I have to do in my code for this to work?
    feel free to test this.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <script type="text/javascript">
    function hide() {
    var div_ref = document.all("id_div");
    div_ref.style.visibility = "hidden";
    function show() {
    var div_ref = document.all("id_div");
    div_ref.style.visibility = "visible";
    </script>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    </head>
    <body>
    <tr>
    <td>
    Select Device Type <BR>
    </td>
    <td style="width:200">
    <input type="Radio" name="DeviceGroup"
    value="Radiobutton1" onclick="show();" checked="checked">Radio
    button 1
    <input type="Radio" name="DeviceGroup"
    value="Radiobutton2" onclick="hide();" unchecked>Radio button 1
    </td>
    <td>
    <div id=id_div style="visibility:hidden;">
    Show Textbox1
    <input type="Text" name="Textbox1">
    </div>
    </td>
    </tr>
    </body>
    </html>
    Thanks

    thanks
    YES
    i will be submitting data to a field in the database.
    First the vlaue of the radio Button
    For example if the first radio button
    then the value of the first radio button value =1
    goes to the field in the database
    also
    the text box that will show. will have data entered in the
    tesx box and the value will be submitted
    to a field.
    thanks
    shall i still use your code????
    thanks
    also, instead of having 2 javascripts controlling the show
    hide, just join them and assume that at each click the div is
    visible.
    the first part of the if statement in the js just makes sure
    the div's display is none. then it displays the one you are
    calling.
    the else allows you to close the divs without having any
    open.
    i'm doing this from home, so i cant really test it, but, it
    looks like it should work.
    Attach Code

  • Javascript:doSubmit action

    Hi all,
    1. I've created an updatable report with buttons in each row.
    2. A click on the button would create a form in the adjoining cell using JS.
    3. When I click on "Save" in that form a table is updated with the comment entered.
    4. At this point I want the page to refresh too. I've tried by using the
    doSubmit('REFRESH_PAGE233');
    and created -
    a. a conditional dummy process which will run if Request = REFRESH_PAGE233
    b. a conditional branch in the page which will redirect to the same page acheiving the page refresh when Request = REFRESH_PAGE233.
    However this does not seem to work for me. Ant suggestions ?
    The application is http://apex.oracle.com/pls/otn/f?p=17276:19
    Thanks,
    - Yogesh

    Looks like someone is testing this app.
    I set the status to 'N' and comments back to null
    so that all the rows appear back in the first report.
    - Yogesh

Maybe you are looking for