Page 1 of 2
datapicker
Posted: Tue Nov 18, 2014 9:17 am
by devd
hi,
I want to display the calendar value in a text box while clicking on the calendar image
Re: datapicker
Posted: Tue Nov 18, 2014 9:21 am
by Celauran
OK? Do you have a question? Are you stuck on something?
Re: datapicker
Posted: Tue Nov 18, 2014 12:03 pm
by devd
Hi,
I am trying to use datepicker in dynamically added multiple textboxes....As I am new to php
don't know...what to do? should i use jquery or javascsript or php code for datepicker code?
and how to apply datepicker to multiple textboxes which is in inside a loop also.
Re: datapicker
Posted: Tue Nov 18, 2014 12:17 pm
by Celauran
What have you tried so far? I'd start with something like
jQuery UI's datepicker.
Re: datapicker
Posted: Tue Nov 18, 2014 12:21 pm
by devd
thank you....I am also checking the same site...but in a confusion that from where I should download the js and css file....
I want to add the calender date format when clicking on a calender image
Re: datapicker
Posted: Tue Nov 18, 2014 12:23 pm
by Celauran
devd wrote:thank you....I am also checking the same site...but in a confusion that from where I should download the js and css file....
http://jqueryui.com/download/
May be best, at least initially, to include all the modules. You can refine later when you're closer to deploying.
Re: datapicker
Posted: Tue Nov 18, 2014 12:23 pm
by Celauran
devd wrote:I want to add the calender date format when clicking on a calender image
Like this?
http://jqueryui.com/datepicker/#icon-trigger
Re: datapicker
Posted: Tue Nov 18, 2014 12:27 pm
by devd
yes...I have finished downloading
jQuery UI 1.11.2 (concatenated JS and CSS files)
jQuery UI 1.11.2 Themes
Re: datapicker
Posted: Tue Nov 18, 2014 12:31 pm
by devd
yes....same as the link you provided...
But I wanted to add the date picker to multiple textboxes
***** Please use the PHP Code tag *****Code: Select all
for($i=0;$i<$row;$i++)
{
$row=mysql_fetch_array($result);
?>
<tr align="center">
<td><?php echo $i+1 ?></td>
<td><?php echo $row['name'] ?></td>
<input type="hidden" value="<?php echo $row['id'] ?>" name="hfldid[]" />
<td><input type="text" name="txtvalue[]"/></td>
<td>
<input type="text" name="txtDate[]"/>
</td>
<td><input type="button" value="select" onClick="displayDatePicker('txtDate[]', this);" >
</td>
</tr>
<?php }
}
almost like this
Re: datapicker
Posted: Tue Nov 18, 2014 12:55 pm
by devd
hello,
please help me...its very urgent
Re: datapicker
Posted: Tue Nov 18, 2014 1:21 pm
by Celauran
devd wrote:I wanted to add the date picker to multiple textboxes
So use a class instead of an ID for your listener. You can still apply .datepicker() to it.
What does your code look like so far?
Re: datapicker
Posted: Wed Nov 19, 2014 12:53 am
by devd
how to add date picker for array textboxes
Re: datapicker
Posted: Wed Nov 19, 2014 6:38 am
by Celauran
Add a class to the text inputs and attach a listener to that class that triggers .datepicker()
Code: Select all
<input type="text" name="whatever" class="datepicker">
And stick this in your document.ready block
Re: datapicker
Posted: Wed Nov 19, 2014 9:02 am
by devd
I am using this code...But now datepicker is coming only for first textbox
<link rel="stylesheet" href="jsdatepick-calendar/jsDatePick_ltr.min.css" />
<script src="jsdatepick-calendar/jsDatePick.min.1.3.js"></script>
<script type="text/javascript" >
window.onload=function()
{
new JsDatePick
(
{
useMode:2,
target:"txtDate",
dateFormat:"%d-%M-%Y"
}
);
};
</script>
This comes inside a table that dynamically adding
<input type="text" name="txtDate[]" id="txtDate" class="datepicker"/>
Re: datapicker
Posted: Wed Nov 19, 2014 9:08 am
by Celauran
Code: Select all
<script src="jsdatepick-calendar/jsDatePick.min.1.3.js"></script>
No jQuery UI? I'm not familiar with that script, so you'd need to post its contents for people to be able to help you. Or at least a link to it.