datapicker

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

devd
Forum Commoner
Posts: 25
Joined: Tue Nov 18, 2014 9:14 am

datapicker

Post by devd »

hi,
I want to display the calendar value in a text box while clicking on the calendar image
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: datapicker

Post by Celauran »

OK? Do you have a question? Are you stuck on something?
devd
Forum Commoner
Posts: 25
Joined: Tue Nov 18, 2014 9:14 am

Re: datapicker

Post 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.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: datapicker

Post by Celauran »

What have you tried so far? I'd start with something like jQuery UI's datepicker.
devd
Forum Commoner
Posts: 25
Joined: Tue Nov 18, 2014 9:14 am

Re: datapicker

Post 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
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: datapicker

Post 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.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: datapicker

Post 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
devd
Forum Commoner
Posts: 25
Joined: Tue Nov 18, 2014 9:14 am

Re: datapicker

Post by devd »

yes...I have finished downloading

jQuery UI 1.11.2 (concatenated JS and CSS files)
jQuery UI 1.11.2 Themes
devd
Forum Commoner
Posts: 25
Joined: Tue Nov 18, 2014 9:14 am

Re: datapicker

Post 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
devd
Forum Commoner
Posts: 25
Joined: Tue Nov 18, 2014 9:14 am

Re: datapicker

Post by devd »

hello,

please help me...its very urgent
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: datapicker

Post 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?
devd
Forum Commoner
Posts: 25
Joined: Tue Nov 18, 2014 9:14 am

Re: datapicker

Post by devd »

how to add date picker for array textboxes
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: datapicker

Post 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

Code: Select all

$('.datepicker').datepicker();
devd
Forum Commoner
Posts: 25
Joined: Tue Nov 18, 2014 9:14 am

Re: datapicker

Post 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"/>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: datapicker

Post 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.
Post Reply