Welcome Guest, Not a member yet? Register   Sign In
Selected on Dropdown list
#1

[eluser]Scott Boyde[/eluser]
I have the flowing code that allows me to change the url and the table data on the view page using the select statement and some scripting.

Code:
<select id="activeDivision" style="width:178px;">
&lt;? foreach ($quick_data->result() as $quick): ?&gt;
<option value="&lt;?=str_replace(' ', '-', ($quick->name));?&gt;" &lt;?=(str_replace(' ', '', ($quick->name==$this->uri->segment(4,0)))) ? "selected" : "";?&gt;>&lt;?=$quick->name;?&gt;</option>
&lt;? endforeach;?&gt;
</select>

[removed]
var quickselect = $('activeDivision');
$('activeDivision').addEvent('change', function(e) {
e = new Event(e).stop();
[removed] = base_url+'division/table/&lt;?=$league['abbrev']?&gt;/'+quickselect.value+'\.html';
});
[removed]

The code works perfectly fine apart from the selected. When I choose an option, the url changes and the table data on the page changes to the approprite information, but the selected returns to the default.

On most occasions this is not a problem but when there are only two options users cannot change back to the first option as its aslways selected.
#2

[eluser]Scott Boyde[/eluser]
Its alright got it sorted.




Theme © iAndrew 2016 - Forum software by © MyBB