472,801 Members | 1,304 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,801 software developers and data experts.

How to submit form to pop-up window *when* changing a select, etc

Hello,

I have a form that submits it's values to a pop-up window. I've
simplied the code:

<form name="formname" action="action.php" target="windowName"
method="post" onsubmit="window.open('', this.target,
'dialog,modal,scrollbars=yes,resizable=no,width=30 0,height=200,left=362,top=284');">
It works perfectly fine when changing form data and then pressing the
submit button. It submits the form to a pop-up window which is 300
pixels wide and 200 pixels high as expected.

However, I would like it so that when somebody changes a <select>, the
form is automatically submitted. The select code is:

<select name="test" onchange="formname.submit();">

On changing the value of the select, the form is submitted to a new
window that is full screen. It is not sent to a pop-up window as
should be.

How do I correct this?

Thanks.
Jul 20 '05 #1
3 24474
In article <fn********************************@4ax.com>, je**@dnuk.com writes:
<select name="test" onchange="formname.submit();">

On changing the value of the select, the form is submitted to a new
window that is full screen. It is not sent to a pop-up window as
should be.

How do I correct this?


Move your onsubmit to a function, call the function onSubmit of the form and
onSubmit of the select name. Return false and allow the function to submit the
form.
--
Randy
Jul 20 '05 #2
On 06 Nov 2003 21:35:12 GMT, hi************@aol.com (HikksNotAtHome)
wrote:
Move your onsubmit to a function, call the function onSubmit of the form and
onSubmit of the select name. Return false and allow the function to submit the
form.


Hello Randy,

I'm not sure what you mean. I have this Javascript at the top of the
page:

<script language="JavaScript" type="text/javascript">
function onSubmit()
{
window.open('', this.target,
'dialog,modal,scrollbars=yes,resizable=no,width=30 0,height=200,left=362,top=284');
}
</script>
And modified the form and selects to this:

<form name="formname" action="action.php" method="post"
onsubmit="onSubmit;">

<select name="select" onchange="onSubmit;">
What else is required?

Thanks for your assistance.

Jul 20 '05 #3
je**@dnuk.com wrote:
[...] hi************@aol.com (HikksNotAtHome) wrote:
Move your onsubmit to a function, call the function onSubmit of the form and
onSubmit of the select name. Return false and allow the function to submit the
form.
[...]
<script language="JavaScript" type="text/javascript">


<script type="text/javascript">

as written before.
function onSubmit()
Although JavaScript is case-sensitive,
you do not want to call it `onSubmit'.
{
window.open('', this.target,
'dialog,modal,scrollbars=yes,resizable=no,width=30 0,height=200,left=362,top=284');
`this.target' is wrong here since `this' refers to the global object in
an ordinary function, not to the Form object as supposed. To reference
the Form object, pass `this' as argument (here: o) in the event handler
and use `o.target' instead.

And I know neither the `dialog' nor the `modal' option. Maybe IE supports
them but it has other methods for dialogs. What you are looking for may be
`dependent'[`=yes'], working only in Netscape 4 and Mozilla/5.0.
}

And modified the form and selects to this:

<form name="formname" action="action.php" method="post"
onsubmit="onSubmit;">
That is neither a function call nor do you return the expected value.
You need to cancel the submit event:

<form ... onsubmit="return foobar(this);">

then you must use `return false;' in the foobar() function. You can
also write

<form ... onsubmit="foobar(this); return false;">
<select name="select" onchange="onSubmit;">
Do not do this. You burden[1] keyboard users to select something.
What else is required?


See above.
PointedEars
___________
[1] What is the appropriate word for the opposite of `(to) ease'?
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bruce Duncan | last post by:
I can't seem to figure our why this doesn't work. I don't get any errors, it just doesn't submit. Can anyone shed some light. <?PHP $var1 = "http://localhost/php/index.php"; $varx = "bruce";...
2
by: Matt | last post by:
Can form.submit() submit another form? In the following example, in page1.asp, it is fine to submit the current form: form1.submit(), and and I could see the value "Joe" in page2.asp. However, if I...
2
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the...
5
by: LevaOpaki | last post by:
Why this work? <a href="#" onClick="Forma1.reset()">Link1</a> and this not? <a href="#" onClick="Forma1.submit()">Link1</a> I get error.
4
by: Sarah | last post by:
Hi all. I have a form, and several text and image links on it that should submit the form with different actions. I prepared a simple page with just the code that's not working. PROBLEM:...
1
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the...
3
by: Megha Vishwanath | last post by:
Hi, I have a struts form <html:form> in which although the focus rests on the submit button, hitting the enter key does not submit the form. I tried capturing the Enter key event and followed...
6
by: tencip | last post by:
Hi everyone, So, i've got a form that is very simple. It hold three elements: username, password, and domain. The goal here is to have the form submit the login to an administrative section...
7
by: David T. Ashley | last post by:
Hi, For a web page, I want a SUBMIT button that commits the form data and a CANCEL button that goes to a different target (i.e. a different script). I haven't figured out how to do this,...
4
by: j1dopeman | last post by:
Hi, I'd like to use a button to save and then submit a form. I can set the onlick of the button to mahButton_click or submit, but I can't figure out how to do both. It looks like c# can't...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.