473,320 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Dropdown list "onchange" help

I have a "submit" button in a form that creates a record in my Filemaker
database that works as it should. This is the HTML for it:

<INPUT TYPE="SUBMIT" name="-New" VALUE="Add Record">

I have a drop down list on that same form that works fine, but I want it to
perform the same submit action as above once a value is chosen. This is the
HTML for it:

<SELECT NAME='CustNo' SIZE=1 onchange='javascript:document.form1.submit();'>
This performs the submit, but doesn't actually work. Somehow I need to pass
the name="-New" parameter in the javascript for the record to be created in
the database. How would I do that?
Thanks.
Jul 20 '05 #1
2 27352
md*****@yahoo.com (Mark Durgee) writes:
I have a "submit" button in a form that creates a record in my Filemaker
database that works as it should. This is the HTML for it:

<INPUT TYPE="SUBMIT" name="-New" VALUE="Add Record">
Seems correct. You are sure the server understands the minus in front
of New correctly?
I have a drop down list on that same form that works fine, but I want it to
perform the same submit action as above once a value is chosen.
That is a bad idea, since it prevents people from navigating using the
keyboard. They will only be able to hit the first option.
This is the HTML for it:

<SELECT NAME='CustNo' SIZE=1 onchange='javascript:document.form1.submit();'>
You don't need the "javascript:" (unless you are writing for IE and
having some other language as default script language for the page -
all other browsers just parse it as a Javascript label).

Since you are already in the form, you can just write:
onchange="this.form.submit();"
That would be equivalent to the onchange handler you had.
This performs the submit, but doesn't actually work. Somehow I need to pass
the name="-New" parameter in the javascript for the record to be created in
the database. How would I do that?


You could probably go through a lot of hoops to get add the parameter,
but I think the easiest way is:
onchange="this.form.elements['-New'].click();"

I still want you to reconsider submitting in the select onchange
property.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
> > <INPUT TYPE="SUBMIT" name="-New" VALUE="Add Record">

Seems correct. You are sure the server understands the minus in front
of New correctly?
That's the button that works correctly.
I have a drop down list on that same form that works fine, but I want it to perform the same submit action as above once a value is chosen.


That is a bad idea, since it prevents people from navigating using the
keyboard. They will only be able to hit the first option.


I didn't really think of that until you mentioned it. However, these aren't
power users and my own observation with people in this office is that many
prefer clicking with the mouse - even though it's so inefficient.
You could probably go through a lot of hoops to get add the parameter,
but I think the easiest way is:
onchange="this.form.elements['-New'].click();"
I got it to work by adding <INPUT TYPE="HIDDEN" name="-New" VALUE="Add
Record"> at the top of the form and using onchange submit()
I still want you to reconsider submitting in the select onchange
property.


I will definitely will take it into consideration. I'll probably build a
page with a submit button and another that does it automatically and see
what the users like better.

Thanks for your help!

Mark
Jul 20 '05 #3

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

Similar topics

1
by: Ron Brennan | last post by:
I've spent all morning on this and now think there is a (slight?) possiblity that onchange doesn't work for input type="file". Can anybody shed any light on this. The onblur fires just fine. The...
1
by: John Pastrovick | last post by:
Is there a way to load an image locally (in the client) when a selection of a file is made using input type=file. The purpose is to allow selection of a file and put the image in the browser...
3
by: Norm via DotNetMonster.com | last post by:
I have an onchange event which fires when the content of an HTML textbox changes. My problem is that when I try to compare the content of this textbox with another HTML textbox using an if...
1
by: julian.tklim | last post by:
Hi, I've got an input box with popup calendar (date picker) all generated using javascipt. Once a date is selected from the datepicker window, the date value is populated back to the input...
6
by: jwarnock | last post by:
When a text field is terminated by a "tab" or change of focus, the browsers behave the same (IE, FireFox, Safari, Netscape). When the text field is terminated by a "return", then "onchange" is...
7
by: slekshmipriya | last post by:
Hai friends.I have a pblm with my drop down list onchange event.The pblm is as follow I have a drop drown list with items 1,2 ,3 etc. On selecting an item from the drop down list i want to...
4
by: mbiasetti | last post by:
Hello, quick question (hopefully): I have a script that manipulates two "Select" elements. My onload calls a function that sets onchange for each "Select": ...
7
by: TriAdmin | last post by:
I am working with a system that allow me to add custom fields but I can not add OnChange() language to the custom fields. So I want to have a function in the header that recognizes when fieldx is...
14
by: white lightning | last post by:
How to have <select onchange="this.form.submit()"and also a Submit button on one form? I have something like this: <form action="<?php $_SERVER; ?>" method="post"...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.