samedi 29 novembre 2014

How to call a function after a date is selected in for a date picker?


Vote count:

0




I'm quite new to javascript and JSP and am having a difficult time wrapping my head around what's getting called and when and where. I'm writing this all in a single JSP file. The starting code I have right now is:



<input type=text name="myTextField" >
<input type=button name="myTextButton" value="Select a date"
onclick="displayDatePicker(myTextField)">

<script type="text/javascript">
// ???
</script>


The first thing that confuses me is the displayDatePicker function. I can't for the life of me find any documentation on this function (is it jquery? is it javascript? is it bootstrap? can i pass in other args?). An alternative would be to declare a custom function and have myTextButton's onclick call that function. I managed to get that to work, but I don't know how to display a datepicker that actually has a callback when a date is chosen.


Here's the functionality I want to have:



  1. User clicks on myTextField, manually types in a date, then an alert pops up "You selected ../../...." or "Invalid date selected"

  2. User clicks on myTextButton, selects a date from the date picker, then myTextField is populated with that date and an alert pops up "You selected ../../...."



asked 40 secs ago







How to call a function after a date is selected in for a date picker?

Aucun commentaire:

Enregistrer un commentaire