Welcome, Guest
Username: Password: Remember me

TOPIC: [FIXED] Using selectors with JDom....input.calendar

[FIXED] Using selectors with JDom....input.calendar 13 Nov 2012 05:59 #5309

  • theitd
  • theitd's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Thank you received: 1
  • Karma: 1
Hi there,

I'm trying to replicate the advice given in the following thread:
www.j-cook.pro/forum/9-coding-inside-you...r-datefrom-is-filled

...and update another calendar field with the picked-date+1yr. If I alter the JDom type from calendar to text, it works.

My code is here:
<?php echo JDom::_('html.form.input.calendar', array(
                                                                                                'selectors' => array(
                                                                                                'onChange' => htmlspecialchars("updatedate();"),
                                                                                                'rel' => 'foo'),
                                                                                                dataKey' => 'assigned_on',
                                                                                                'dataObject' => $this->numbersitem,
                                                                                                'dateFormat' => "%Y-%m-%d",
                                                                                                'domClass' => "validate[custom[timeYYYYmmdd]]",
                                                                                                'validatorHandler' => "timeYYYYmmdd"
                                                                                                ));
?>

It results in the following html (with no onchange):
<input type="text" title="Monday, 21 March 2011" name="assigned_on" id="assigned_on" value="2011-03-21" class="inputbox validate-timeYYYYmmdd validate[custom[timeYYYYmmdd]]">

Is there a way of using the selectors with the JDom input type for the calendar?
The administrator has disabled public write access.

Re: Using selectors with JDom....input.calendar 13 Nov 2012 16:14 #5338

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi @theitd

Double check the source of the form because the calendar is just a widget. Even when you use the calendar, you are actually storing the value into a text field using a date mask according to your specifications.

In fact, if you want to make it 1 year after, it's probably best not to give the user access to change the second date. Anyway, however you choose to do it, you should check out this over at jquery:
forum.jquery.com/topic/jquery-date-problem

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Re: Using selectors with JDom....input.calendar 13 Nov 2012 18:04 #5340

  • theitd
  • theitd's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Thank you received: 1
  • Karma: 1
Thank you, perfect!

I've added the <%SELECTORS%> tag to the calendar input form in:
<component_name>/dom/html/form/input/calendar.php

So the variable $html is now defined (from line 143) as....
$html = self::calendar(
                                       $formatedDate,
                                       $this->getInputName(),
                                       $this->getInputId(),
                                       $this->dateFormat,
                                       'class="' . $this->getDomClass() . '"<%STYLE%><%SELECTORS%>',

The link to the datepicker+1 is precisely what I'm trying to do too.
As a PHP and jQuery noob, j-cook has proved really useful - so thanks very much for the help.
Last Edit: 13 Nov 2012 18:07 by theitd. Reason: Removed attempt to highlight within CODE.
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy

Re: Using selectors with JDom....input.calendar 21 Nov 2012 15:33 #5571

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Excellent.

Thanks.

Will check it out.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Using selectors with JDom....input.calendar 21 Nov 2012 15:36 #5573

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Karma K+1

And Welcome to the community !
Excellent behaviors is to post solutions even before to ask for help.

Cool. :)
Coding is now a piece of cake
Last Edit: 21 Nov 2012 15:38 by admin.
The administrator has disabled public write access.

Re: Using selectors with JDom....input.calendar 28 Nov 2012 13:16 #5670

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Fixed in JDom.

Thanks again.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy
Time to create page: 0.060 seconds

Get Started