View Full Version : Form help

08-25-2011, 09:01 PM
Hi guys

I have a select "combobox" that when you click on an option from the list it submits the value, which is what i want it to do. But I would also like to have the select "combobox" become disabled or greyed out after an option is selected. I can get these to work seperatly but not together. Is it possible to have 2 onchange events in one form?

here is what i am working with:

<script type="text/javascript">
function makeDisable(){
var x=document.getElementById("filter11")

<td><Select name='filter11' id="filter11" onChange="filters.submit();" onchange="makeDisable()">
<option value=''>Months (Any)</option>
blah blah

08-25-2011, 09:11 PM
Despite the similar sounding names, Java is not the same as Javascript.
Moving from Java forum to Javascript forum.

08-25-2011, 09:40 PM

Old Pedant
08-25-2011, 10:06 PM
Just call both functions from the *SINGLE* onchange.

<Select name='filter11' id="filter11" onChange="filters.submit();makeDisable()">

08-25-2011, 10:12 PM
Hi Old pendant.

Yeah I did try that, it submits the form ok, but it only disables the form for 1 second... I have the form submiting to the same page.(index.php) Should that matter?

Old Pedant
08-25-2011, 11:29 PM
Oh...once you submit the <form>, the server *RELOADS* the ENTIRE PAGE. So any changes you make via JavaScript will be completely lost in the re-loaded page.

You will need to take care of this in you server-side code. That is, if this is a PHP page, use PHP code to detect that the <select> has been used and disable it via PHP. (Or ASP or JSP or whatever.)

08-25-2011, 11:59 PM
ah, I see. That makes sense!

Will have a go with the php script!


Philip M
08-26-2011, 07:32 AM
Or you could use a Javascript cookie.

But I would also like to have the select "combobox" become disabled or greyed out after an option is selected.

Why? That means that the user cannot change his mind. Surely a user-hostile approach!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum