473,626 Members | 3,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

submit a form after confirmation through a customised window

7 New Member
Hi all,
I want to submit a form after confirmation through a customised window. I have 4 buttons in <af:form>, one of which is continue button that has to navigate the form to another page while executing the action:
--------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <af:commandButton id="continueBtn"
  2.     onclick="return NewWindow()"
  3.     action="#{CoverageMPB.process}" text="continue" />
----------------------------------------------------------------
javascript:
-------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. function NewWindow(){
  2. window.open("url","fg","height=250,width=700");
  3. return false;
  4. }
  5.  
  6. function check(){
  7. if(document.forms[0].radios[0].checked){
  8. self.close();
  9. document.parent.getElementById("my_form").submit(); 
  10.                   //my_form is the id of <af:form> that is the parent document's form.
  11. }
  12. else {
  13. self.close();
  14. }
  15. }
-------------------------------------------------------------------------
child window: (jsf file)
----------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <af:form  id="form1" >
  2.         <af:panelBorder id="boder1">
  3.              <af:panelForm labelWidth="5%" id="form2">
  4.                      <af:panelHorizontal>
  5.                      <af:selectOneRadio id="radios" layout="horizontal"  value="" onclick="check()">
  6.                       <af:selectItem label="Yes"   value="Yes"></af:selectItem>
  7.                        <af:objectSpacer width="5"/>
  8.                       <af:selectItem label="No"  value="No"></af:selectItem>
  9.                      </af:selectOneRadio>
  10.                    </af:panelHorizontal>
  11.              </af:panelForm>    
  12.         </af:panelBorder>
  13. </af:form>
------------------------------------------------------------------------------------------
Can anybody help me in finding out why the form is not getting submitted when i click on Yes?
Oct 17 '07 #1
9 5480
gits
5,390 Recognized Expert Moderator Expert
hi ...

change this:

Expand|Select|Wrap|Line Numbers
  1. document.parent.getElementById("my_form").submit();
  2.  
to:

Expand|Select|Wrap|Line Numbers
  1. opener.document.getElementById("my_form").submit();
kind regards
Oct 17 '07 #2
shiks1305
7 New Member
Hi,
Thanks for replying. But I've tried putting even that statement. But its not working.
Oct 17 '07 #3
gits
5,390 Recognized Expert Moderator Expert
try an alert before that statement ... may be you should close the window after! trying to submit?

kind regards
Oct 17 '07 #4
gits
5,390 Recognized Expert Moderator Expert
and try to trace whether your condition returns true!

kind regards
Oct 17 '07 #5
shiks1305
7 New Member
yeah i have done that also. it does return true and it can even click another button in parent form when i replaced submit statement with getElementById( "button2id").cl ick();.
I mean condition is being satisfied for sure and it is able to access the parent form's elements. But doesn't submit the form



and try to trace whether your condition returns true!

kind regards
Oct 17 '07 #6
gits
5,390 Recognized Expert Moderator Expert
i'm confused now ... is it a popup window or a frame? please try to explain the related application-design very clear ... in case you have a frame ... then you have a parent ... in case you have a popupwindow or another window at all ... it should be the opener. please explain it in more detail ...

kind regards
Oct 17 '07 #7
shiks1305
7 New Member
ok. see, I have page1.jsf that has submit button. when i click on this button a pop up window should be opened that has a group of 2 radio buttons: "Yes" and "No". Upon selecting any radio button, pop up should be closed. further, if "yes" was selected, page should be submitted.



i'm confused now ... is it a popup window or a frame? please try to explain the related application-design very clear ... in case you have a frame ... then you have a parent ... in case you have a popupwindow or another window at all ... it should be the opener. please explain it in more detail ...

kind regards
Oct 17 '07 #8
gits
5,390 Recognized Expert Moderator Expert
hi ...

in this case the following function should work:

Expand|Select|Wrap|Line Numbers
  1. function check() {
  2.     if (document.forms[0].radios[0].checked) {
  3.         opener.document.getElementById('my_form').submit();
  4.     } 
  5.  
  6.     window.close();
  7. }
try it and let me know whether you get any errors with that or not?

kind regards
Oct 17 '07 #9
shiks1305
7 New Member
HI, it was also not working. Then, I changed the logic. Instead of submitting, I am now, clicking that button again and based on a variable (hidden field), making it return true. Now, it's working fine. Anyways, thanks for responses.

hi ...

in this case the following function should work:

Expand|Select|Wrap|Line Numbers
  1. function check() {
  2.     if (document.forms[0].radios[0].checked) {
  3.         opener.document.getElementById('my_form').submit();
  4.     } 
  5.  
  6.     window.close();
  7. }
try it and let me know whether you get any errors with that or not?

kind regards
Oct 18 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
17439
by: Joel | last post by:
Hi there, My original window (A) opens a modal dialog window (B). In B, you fill out a form and submit it to itself for processing. When B reloads, it knows that is successfully processed the form and it suppose to close itself after returning "1" or "0" to A. My problem is that B will never close. When I submit it, it kind of opens a new window and close that one before
2
73363
by: Terence Parker | last post by:
How does one go about submitting a form with a link - but submitting it to a new window AND to a page different to that described within the action="" option of the <form> tag? Say, for example, I have a simple form such as the following: <form method="POST" action="submit.php" name="AForm"> Name: <input type="text" name="Name" length="20"><br> Age: 15 <a href="age.php">change age</a><br> <input type="submit" name="submit"...
13
1746
by: John Kiernan | last post by:
Hey JavaScript gurus... I'm going to try this again. I haven't gotten as much help as I have advice on style<grin>. I appreciate (having programmed in other languages for quite a while) that everyone has their own opinion on HOW things should be done. However, if it does not comes AFTER helping me figure out my problem, please... (fill in your own polite way to say 'save the bandwidth'). I have code in a MouseUp of my save button...
3
4022
by: jforena | last post by:
Hi, I am trying to create a javascript that will display a confirmation message when a user submits a form and has specifically selected a particular radio button. For example: <form action="foo.cgi" method="post"> <input name="question1" type="radio" value="1">Value 1</input>
5
5893
by: Codeman II | last post by:
Hi there, I am building a form where the user must upload a picture and fill in his details. Now I have a problem as all of this is on the same form. How will I be able to have the Browse button to open the "file browse" dialog and the Submit button to submit the form data.
2
2147
by: b3t1m0s | last post by:
Hi everyone here! I have a special case and I want to ask can I realize this in JavaScript/AJAX. The case is: I have html submit form that should send data to php file. When submit button is pressed a "popup" or modal windows must be displayed and user must click in page (ex. image), and page should open a new window (from image hyperlink ex.) and return to the main page (submit form) to finally send data to php file. Is this realized in...
3
2710
oll3i
by: oll3i | last post by:
my javascript function doesnt work on submit? <form method="post" action="" name="client_form" onsubmit="return checkForm(this,<?echo $number ?>,<?echo $language?>);"> function checkForm(form,number,language){
11
5288
by: V S Rawat | last post by:
using Javascript, I am opening a web-based url in a popup window. MyWin1=Window.Open(url, "mywindow") There is a form (form1) in the url in that popup window, I need to submit that form. How do I submit that form1 from the javascript from my current window? Thanks.
4
14495
by: John Straumann | last post by:
Hi all: I have an ASP.NET form that submits info to the server, but the customer wants a confirmation window to open when the user clicks "Submit", and then the user would have to click "OK" on the popup window to have the main form submit. I found some samples of using JavaScript to create a popup window, but then the OnClick event for the form button runs the JavaScript as opposed to the server side code. Can anyone suggest how I...
0
8707
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5575
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2628
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1812
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.