onselect() +reload
Moderator: General Moderators
-
bob_the _builder
- Forum Contributor
- Posts: 131
- Joined: Sat Aug 28, 2004 12:25 am
onselect() +reload
Hi,
How does one go about having a listmenu, when a user makes a selection, have it reload the page so the post data can me selected?
Thanks
How does one go about having a listmenu, when a user makes a selection, have it reload the page so the post data can me selected?
Thanks
-
bob_the _builder
- Forum Contributor
- Posts: 131
- Joined: Sat Aug 28, 2004 12:25 am
Hi,
Thanks, I did look at that option. Problem is that I dont want it to jump to another url.
I am wanting it to reload the page and post the data.
value"" needs to hold value"Jan" not a url:
Thanks
Thanks, I did look at that option. Problem is that I dont want it to jump to another url.
I am wanting it to reload the page and post the data.
value"" needs to hold value"Jan" not a url:
Code: Select all
<form action="../calendar.php" method="get">
<select id="month" name="month">
<option '.( $month==Jan ? 'selected' : '' ).' value="Jan">Jan</option>
<option '.( $month==Feb ? 'selected' : '' ).' value="Feb">Feb</option>
<option '.( $month==Mar ? 'selected' : '' ).' value="Mar">Mar</option>
<option '.( $month==Apr ? 'selected' : '' ).' value="Apr">Apr</option>
<option '.( $month==May ? 'selected' : '' ).' value="May">May</option>
<option '.( $month==Jun ? 'selected' : '' ).' value="Jun">Jun</option>
<option '.( $month==Jul ? 'selected' : '' ).' value="Jul">Jul</option>
<option '.( $month==Aug ? 'selected' : '' ).' value="Aug">Aug</option>
<option '.( $month==Sep ? 'selected' : '' ).' value="Sep">Sep</option>
<option '.( $month==Oct ? 'selected' : '' ).' value="Oct">Oct</option>
<option '.( $month==Nov ? 'selected' : '' ).' value="Nov">Nov</option>
<option '.( $month==Dec ? 'selected' : '' ).' value="Dec">Dec</option>
</select>
</form>Thanks
-
bob_the _builder
- Forum Contributor
- Posts: 131
- Joined: Sat Aug 28, 2004 12:25 am
Hi,
Still not doing very well, so far I have the onselect() working but its not posting the form data:
I guess I am missing something?
Thanks
Still not doing very well, so far I have the onselect() working but its not posting the form data:
Code: Select all
<form action="../calendar.php" method="get">
<select name="monthnum" onchange="window.location=\'../calendar.php\'">
<option '.( $monthnum=='Jan' ? 'selected' : '' ).' value="Jan">Jan</option>
<option '.( $monthnum=='Feb' ? 'selected' : '' ).' value="Feb">Feb</option>
<option '.( $monthnum=='Mar' ? 'selected' : '' ).' value="Mar">Mar</option>
<option '.( $monthnum=='Apr' ? 'selected' : '' ).' value="Apr">Apr</option>
<option '.( $monthnum=='May' ? 'selected' : '' ).' value="May">May</option>
<option '.( $monthnum=='Jun' ? 'selected' : '' ).' value="Jun">Jun</option>
<option '.( $monthnum=='Jul' ? 'selected' : '' ).' value="Jul">Jul</option>
<option '.( $monthnum=='Aug' ? 'selected' : '' ).' value="Aug">Aug</option>
<option '.( $monthnum=='Sep' ? 'selected' : '' ).' value="Sep">Sep</option>
<option '.( $monthnum=='Oct' ? 'selected' : '' ).' value="Oct">Oct</option>
<option '.( $monthnum=='Nov' ? 'selected' : '' ).' value="Nov">Nov</option>
<option '.( $monthnum=='Dec' ? 'selected' : '' ).' value="Dec">Dec</option>
<input name="prev" type="hidden" value="prev">
</select>
</form>Thanks
-
bob_the _builder
- Forum Contributor
- Posts: 131
- Joined: Sat Aug 28, 2004 12:25 am
-
bob_the _builder
- Forum Contributor
- Posts: 131
- Joined: Sat Aug 28, 2004 12:25 am
This is what I have at the moment, is it fit for the job?
Thanks
Code: Select all
<form action="../calendar.php" method="get">
<select name="monthnow" onChange="form.submit()">
<option '.( $monthnow=='1' ? 'selected' : '' ).' value="1">Jan</option>
<option '.( $monthnow=='2' ? 'selected' : '' ).' value="2">Feb</option>
<option '.( $monthnow=='3' ? 'selected' : '' ).' value="3">Mar</option>
<option '.( $monthnow=='4' ? 'selected' : '' ).' value="4">Apr</option>
<option '.( $monthnow=='5' ? 'selected' : '' ).' value="5">May</option>
<option '.( $monthnow=='6' ? 'selected' : '' ).' value="6">Jun</option>
<option '.( $monthnow=='7' ? 'selected' : '' ).' value="7">Jul</option>
<option '.( $monthnow=='8' ? 'selected' : '' ).' value="8">Aug</option>
<option '.( $monthnow=='9' ? 'selected' : '' ).' value="9">Sep</option>
<option '.( $monthnow=='10' ? 'selected' : '' ).' value="10">Oct</option>
<option '.( $monthnow=='11' ? 'selected' : '' ).' value="11">Nov</option>
<option '.( $monthnow=='12' ? 'selected' : '' ).' value="12">Dec</option>
<input name="prev" type="hidden" value="">
</select>
</form>Thanks
~feyd has told you twice what you need to do.
- Make your select box set the value of "prev" when its value is changed. There are LOTS of examples of this online.
- Submit the form. Again, there are lots of examples of how to reference a form online, and yes, submit() is the proper function.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.