By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,483 Members | 1,909 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,483 IT Pros & Developers. It's quick & easy.

Dropdown list "onchange" help

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
> > <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 discussion thread is closed

Replies have been disabled for this discussion.