New window everytime when submit button clicked in JSF

Hi all,
I am facing an issue where I need to popup a new window everytime the submit button on my JSF form is clicked.
I have tried several methods but none is working to my purpose.
1. Add a target="_blank" attribute in the JSF form. The problem is that even if any of my ValuechangeListeners get invoked, the page is rendered in a new window. My ValuechangeListeners work on onchange="submit()".
2. Invoke a new window from javascript and name the window as say" new" . Also name the form's target as "new" but this does not generate a new window everytime and also problem 1 persists.
3. If i use actionlistener and onclick event on button in the form, then the new page is rendered in both current page and new window.( javascript for new window is written).
What I need is when a person clicks on submit button in the form, a new window should always popup up and the page should be rendered in the new window. The original form should remain as it is so that a user can again do a submit and get a new window.
Please suggest.

devayani wrote:
Thanks all for the replies.
Try onchange="this.form.target='_self';submit();"This works fine if all the valuechangelisteners are invoked. Suppose,if I dont select the radio
button and dont select any values in list box. Now if i click submit, since the target=_blank,
the page giving validation errors (for not selecting the list box)
renders in a new page. As expected behavior, not my solution.
If you need validation to remain in the same window (and that seems like the best for the user experience you have described), then delay the creation of the new window until after the request finishes. I.e., your page should always go back on itself. Under the right conditions (which you can set in your action method) it conditionally writes JavaScript which targets the new window.
>
Try returning false from the onclick event.I had tried it long back, so I just messed it up while writing, there were no actionlisteners.
sorry about my third solution, lets consider solution 2 as below:
Javascript
<script type="text/javascript" >
     function newWindow(){
          window.open('','mywindow','width=400,height=200');
          return false;
     </script>
JSF
<h:form id="Frm_New" target="mywindow">     
<h:commandButton id="btn_submit" disabled="false"             
              action = "#{TestBean.submitValues}"
              value="#{bundle.SC_SUBMIT}"
              onclick ="newWindow()">But again this approach has above problems and also no new window everytime. For new window you said:
Append a time stamp or random number to
the end of the window name.This solution will not work as I have to reset the target for my form everytime to this new window name.You can remember the name of the window if necessary. Although you seem to be changing things on the fly; earlier the problem was you didn't get a new window every time. Or are you just confused on how to set the target?
onclick="var wname = getWindowName(); createNewWindow(wname); this.form.target = wname; return true;">
I was trying to actually set the target of the form as _blank at runtime during one of the phases of JSF lifecycle ( by using phaselistener). Although its not working as of now. Does this sound a good approach
This is because I dont think that setting it on jsf would work as the page rendering on a new window( in my case) not only depends on clicking the submit button only but it depends on whether the user is done with all vaildations and now has to see the final result into new window.This would be addressed by the conditional JavaScript solution above.

Similar Messages

  • Adding a Warning dialog box when submit button click

    Having troubles figuring out how to add a warning dialog when user click submit asking if he would like to proceed if a column field is null.

    Umm is it possible to do this with validation on submit and cancel the process mid way. if they hit cancel.
    Because data may be deleted in the database or change if i don't do it upon submit.
    E.G i kind of want to achieve something like this but i'm very unsure if it's even possible call a validation?
    boolean isValid
    isValid = call validation_name
    If isValid = false THEN
    javascript:if(confirm('Are you sure?')){doSubmit('P5_SUBMIT');}
    else
    javascript:doSubmit('P5_SUBMIT');
    END IF;Edited by: PandaOracle on Jan 24, 2012 10:19 AM

  • I've lost the "Send" button in my reply window. When I double click on a Mail message, on order to reply, the "Send" button at the top of the window is missing. I can reply by closing and saving my reply, and re-openning from Drafts. How to fix?

    I've lost the "Send" button in my reply window. When I double click on a Mail message, on order to reply, the "Send" button at the top of the window is missing. I can reply by closing and saving my reply, and re-openning from Drafts. How to fix?

    Hi, try this...
    If nothing is showing in the Toolbar at top, click the little gray oval at top right.
    Right click or Control+click on the Toolbar, choose Customize Toolbar, drag the Send button to the Toolbar.

  • Display success message in same page when submit button is clicked

    I have a jsp page, where i use a form to submit data into my database.when submit button is clicked, i am able to display "Data entered Successfully" in a different page. But i want to display the message in the same jsp page.
    what do i do?
    PS :- i have tried a javascript message box, but that is not working properly. I need this solved urgently.
    Thanks

    Hi Deeptha,
    What is APEX version your using and is it your select list with submit option ?
    Regards,
    Ajay Periwal

  • How to submit data from multiple Input Ports in single SUBMIT button  click

    Hi,
    I am in SPS8.
    What exactly steps I need to perform to submit data from multiple Input Ports.
    I couldn't able to submit One input Form and one Input Table to BAPI data service in single SUBMIT button click.
    I debugged the VC application in SPS8.
    While debugging, I found that when I click the SUBMIT button in the Input Form, Only data in that Input
    form are being passed to the BAPI, But not the Table Form data.
    If I click on the SUBMIT button in another Input Table, Only data from that table is being passed to the BAPI, but not the Input form data.
    Essentially I need to submit both of them in one SUBMIT button.
    Thanks,
    Ramakrishna

    Ramakrishna,
    From the word document that you sent to me the steps you are missing to map the appropriate information into the BAPI is first you are not mapping all data rows into the table input port. To do this double click on the input table view and change your selection mode from single to multiple. Then when you click on your link between the BAPI and your input table you will see a new option appears under data mapping "Mapping Scope" select All Data Rows.
    That's the first part of the problem to get the BAPI to recognize both the inputs coming from the form and the table eliminate the submit button from the form. Drag and drop a link from the output port of the table view to the Input port of the BAPI. Double click on the link between the BAPI and the table view and open the expressions editor for the two fields:
    1/ Automatic Source
    2/ SKIP_ITEMS_WITH_ERROR
    On the hierarchical folder structure on the right expand expand the Data Fields node to find the fields from the form and map them accordingly.
    Now when you hit the submit button on your table it should pass the BAPI all the parameters from both the form and the table.
    Hope this helps,
    Cheers,
    Scott

  • Multiple flash files change when a button click using javascript function

    hi.. am new in flsh...
    i want to multiple flash files change when a button click using a javascript

    <script>
    var count=0;
    function mafunct(newSrc){
        alert("hi");
    var path="a"+count+".swf"; 
    flash+='<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" WIDTH="100%" HEIGHT="100%">';         
        flash+='<PARAM NAME=movie VALUE="'+path+'">';         
        flash+='<PARAM NAME="PLAY" VALUE="false">'; 
        flash+='<PARAM NAME="LOOP" VALUE="false">';
        flash+='<PARAM NAME="QUALITY" VALUE="high">';
        flash+='<PARAM NAME="SCALE" VALUE="SHOWALL">';
        flash+='<EMBED NAME="testmovie" SRC="Menu.swf" WIDTH="100%" HEIGHT="100%"PLAY="false" LOOP="false" QUALITY="high" SCALE="SHOWALL"swLiveConnect="true"PLUGINSPAGE="http://www.macromedia.com/go/flashplayer/">';
        flash+='</EMBED>';
        flash+='</OBJECT>';    
    count++;
    alert(path+"aa");
    </script>
    <button onclick="mafunct()">next</button>

  • Whenever i have a mozilla browser on and i try to open another mozilla window browser it work pull up a new window. When close the browser that was on, it will still show up on Task Manager. Whats going on with this?

    Whenever i have a mozilla browser on and i try to open another mozilla window browser it work pull up a new window. When close the browser that was on, it will still show up on Task Manager. Whats going on with this?

    There are other things that need attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    *Shockwave Flash 10.0 r32
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/

  • How to get  current row(Based on Radio button check)  submit button Click

    Hi i hava Query Region Search(Based On Auto Customization Criteria).
    For Showing Results iam Using Table Region.
    Using Radio button How we get the row reference value using Submit button Click.
    Please Help on this .
    Thanks & Regards
    San

    Hi san ,
    Try this
    if ("EventID".equals(pageContext.getParameter(EVENT_PARAM)))
    String rowRef = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    OARow row = (OARow)am.findRowByRef(rowRef);
    VORowImpl lineRow = (YourVORowImpl)findRowByRef(rowRef); // Replace your vo name .
    Please refer this link , Let me know if its not clear .
    Single Selection in table Region in OAF .
    Keerthi

  • How can I totally disable occurrence of the New Tab tab when I right-click to open a new window?

    Whenever I right-click on a link in Firefox and choose "Open Link in New Window", the resulting new window opens with TWO tabs: a tab containing the target for the clicked link and another "New Tab" tab containing icons for sites I don't want and don't care about. Even more annoying, the "New Tab" tab is the tab that is active/selected when the new window comes up, rather than the tab for the link I right-clicked.
    This is very annoying and highly undesirable behavior. When one right-clicks on a link and chooses "Open Link in New Window", one should get a new window containing ONLY the displayed information for the target link. One should not get TWO tabs.
    How do I get rid of this behavior? I've searched via Google for a solution but haven't found one.
    I hope the Mozilla team will correct this problem very soon. I've been using Firefox for a long time and have found it to be a very good browser. However, this new behavior totally destroys my good feelings about Firefox.
    Thanks for reading my comments.

    Starting Firefox in Safe Mode does indeed get rid of the behavior I find undesirable. Thank you.
    However, I still wonder why one should have to go through the extra step (starting in Safe Mode) to avoid the second tab in the newly opened window.
    I have not added any add-ons to Firefox on my PC.
    The problem suddenly started occurring a while back, after an automatic update of Firefox to the latest version.
    Any thoughts on WHY this is happening?

  • I have Google set to show results in a new window. When I click on a results page link Firefox reverts to search results page almost instantly

    I have Google set to show results in a new window, never use Google instant & search filtering off. When I click on a link on the results page Firefox reverts to the search results page almost instantly. I can of course select the desired page (via windows Aero). This happens on several computers, PCs & Laptops.
    Not a major problem but VERY irritating. This seems to have happened from a few update ago ?

    This can be caused by corrupted cookies or cookies that aren't send or otherwise blocked.
    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    *http://kb.mozillazine.org/Cookies

  • Popup window when radio button clicked

    Hello,
    I have a button that has a URL redirect of:
    javascript:popUp2('f?p=&APP_ID.:8:&SESSION.::NO:::', 400, 400);
    This opens a separate window.
    Now I want this to happen when the user clicks on a radio button on that page.
    Thank you,
    Matt

    You dont have to put this in html head..
    ON THE PAGE RENDERING SECTION..
    UNDER ITEMS... FIND THE RADIO BUTTON ITEM AND CLICK ON THAT..
    U WILL SEE DIFFERENT TAB OVER THERE... LIKE .. SHOW ALL , NAME , DISPLAYED , LABEL , ELEMENT ... ETC..
    SELECT ELEMENT..
    UNDER ELEMENT YOU WILL SEE
    HTML FORM ELEMENTS ATTRIBUTES... IN THAT TEXT BOX U JUST HAVE TO COPY AND PASTE THE ABOVE CODE

  • New to Flash, create a flash form which is emailed using CGI script when submit button is pressed

    I'm trying to build a form in flash that is emailed using CGI
    script. I'm just lost and confused and I just can't seem to figure
    this out.
    This is the CGI coding for HTML and I just need to convert it
    to use in CS3:
    <form action="
    http://www.hostmonster.com/monstermail"
    enctype="multipart/form-data" method="POST">
    Name: <input type="text" name="Name"><br>
    Email: <input type="text" name="mailfrom"><br>
    Phone: <input type="text" name="Phone"><br>
    Service: <input type="text" name="Service"><br>
    <input type="hidden" name="sendtoemail"
    value="[email protected]"><br>
    <input type="submit" value="Send Email">
    </form>
    This is a link to what I'm working on:
    http://www.alternativesolutionsforyou.com/contact.htm

    OK, sorry....no more errors when I test the movie but when I
    test it live....nothing happens???? Here's the link again:
    http://www.alternativesolutionsforyou.com/contact.htm
    Code as it is:
    lv=new LoadVars();
    lv.Name=name.text;
    lv.mailfrom=email.text;
    lv.Phone=phone.text;
    lv.Service=service.text;
    lv.sendtoemail="[email protected]"
    yourSubmitButton.onPress=function(){
    lv.sendAndLoad("
    http://www.hostmonster.com/monstermail",lv,"POST");
    lv.onData=function(){
    // data successfully sent
    // this will execute if your cgi script returns something
    after executing
    I haven't adjusted what happens after you his the submit
    button yet.....just trying to get the email working.

  • Why does firefox opens new window/tab when i click on a link

    if I click any link in Firefox it will open another blank window in addition to the link clicked, blank window opens on top. how do I stop this

    If a website codes its links to open in a new window, you can divert that to a new tab.
    The basic setting for this is here:
    "3-bar" menu button (or Tools menu) > Options > Tabs
    The first checkbox: "Open new windows in a new tab instead"
    In some cases, a website uses a script to launch a new window with special features, such as a set height/width, or with one or more toolbars removed. To avoid breaking sites that create dialog boxes this way, Firefox does not normally divert this kind of window to a new tab. However, if you wanted to send these to a tab as well, there is a hidden setting you can change. (See: https://support.mozilla.org/questions/1035103#answer-662627])
    If Firefox is sending ALL links to new windows or new tabs, you might have an extension like Tab Mix Plus or Tab Utilities which changes the built-in tab handling features. You would need to explore their settings to get it just the way you want it.

  • Tabs opening as new windows even when I click open in a new tab

    All of a sudden links that normally opened as new tabs are now opening as new windows. Even when I specifically say open as a new tab it still opens as a new window. I have checked the settings in the tab option so it should be opening them as new tabs. it is highly frustrating!

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • New window opens when I click a link

    On some sites, every time I click on one of the links, a new instance of Safari opens. The same site does not do this in IE or Firefox and in latter, you have controls of how links open..new window, new tab, or force open within current window. Anyone know how to keep only one window open in Safari?

    If you want new windows to open in a new tab, instead of a new Safari window, just hold ctrl while clicking on the link. Make sure this option is enabled in Edit->Preferences->Tabs, if it doesn't work for you right off the bat. You can also do what I do, and simply right-click on the link, and select Open Link In New Tab.
    There are some other neat Tab features too, if you have multiple windows open already, you can go to Window->Merge All Windows, and all open pages are moved to Tabs in a single Safari Window.
    Conversely, you can send a Tab to a new, separate window, by going to Window->Move Tab To New Window.
    Message was edited by:  Andy

Maybe you are looking for

  • Installing Windows 8.1 Pro 32 bit on Lenovo H500s

    I have installed a brand new (clean) 2T drive in the Lenovo H500s and I have Windows 8.1 PRO 32 bit retail disk. I'm trying to get this to install on the new drive but can't even get the unit to see the CD. I've gone in to the BIOS and set the CDROM

  • Quantity column display upto 2 decimal places in ALV

    I've created an ALV for dynamic columns. For this i've first created the fieldcatalog and then the internal table. The problem that i'm facing in this is that the user wants the quantity column to be displayed upto 2 decimals. For this i tried the fo

  • Changing fonts in Safari 6

    The font settings are gone from Safari's Preferences. How am I supposed to change the font?

  • I have inserted a non supported CD that won't come out of the DVD player

    How can I get the non-supported DVD to eject?  Nothing happens when I hit the eject button.

  • Advice offered for crashing Safari

    After I updated my Safari to 3.2.1, it began crashing frequently. After two calls to AppleCare, I think the problem is resolved. If you're having this problem and have OS X 10.2 or later and have your two Mac OS X Install Discs, try doing Archive and