Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom JQuery datepicker not returning selected date
    text
    copied!<p>I used datepicker plugin to build a custom selector that only gives me the option between the two semesters in a year. It has to be either January-June or July-December.</p> <pre><code>&lt;script&gt; $(document).ready(function() { $( "#semester" ).datepicker({ stepMonths: 6, nextText: "Next semester", prevText: "Previous semester", monthNames: ["January - June", "", "", "", "", "", "July - December", "", "", "", "", ""] }); $( "#semester" ).datepicker('setDate', new Date(2012,0,1)); }); &lt;/script&gt; </code></pre> <p>and</p> <pre><code>&lt;style&gt; .ui-datepicker-calendar { display: none; } &lt;/style&gt; </code></pre> <p>Well, I can't post images yet, but it basically gives me a one-liner like "January-December ". Scrolling it to the right gives me "July-December 2012", and so on.</p> <p>I call it using </p> <pre><code>&lt;div id="semester" name="semester" class="date-picker"&gt;&lt;/div&gt; </code></pre> <p>which inside a standard form with a standard Submit button.</p> <p>Now, it looks just the way I want, since I don't want an <code>&lt;input type="text"&gt;</code>but the problem is that this way the data isn't sent, according to print_r($_POST), but other elements in the form are. I'm obviously missing something here.</p> <p>NOTE: I decided to use JQuery basically for design preference, since datepicker looks so neat. Although, I realize now that using JQuery for this was probably overkill, but since I've made it this far, I'd like to finish it.</p> <p>Also, if someone has a better/less complicated and maybe even equally neat idea on how I can accomplish this, please tell me. Thanks in advance.</p> <p>EDIT: I've found here in SO another topic in which the same problem I'm having is also present: <a href="https://stackoverflow.com/a/8721023/1115775">See the answer</a>. Apparently, there's no way to select the date once I hide the days. Perhaps the answer to this will include an event involving <code>setDate</code>? I'm at a loss.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload