Hi cwcrawley, I’m afraid I’ve run out of time to spend on this at the moment - am planning on picking it up again once 2.0 is released next month (along with an updated version of the fieldframe api).
In the meantime I’d guess that you need to make sure that each cell in your matrix has a unique ID value (as opposed to each row, which IIRC is what the hack does at the moment).
changing agun’s hack to something like
$td.find('*[id]').each(function() {
this.id = obj.fieldName+'['+rowIndex+']' + this.name.substring(this.name.indexOf(']')+1);
});should add the column index value to the field ID and fix the issue you’re experiencing when you have multiple instances in a single row. I’ve done a very quick (firefox only) test and that seems to do the trick.
please do note though that this really isn’t a released extension - in fact it’s still so alpha it hurts - so I would be extremely cautious about using it in a production environment. At the very least don’t expect to just “grab and go” - it will almost certainly require some tweaking to get it to do what you want it too. Unfortunately it that also means that I can’t offer any guaranty of further support… sorry!
Buggerit.
I searched for a date picker extension high and low. Din’t find anything. So write my own. Finish it, then about to add it to the forums, and I find this thread.
Typical!
Ho Hum. The problem you’re having is that the JavaScript registers the fields on loading the page, then FF Matrix does a duplication of the row to create a new row - but doesn’t re-call the JavaScript code, so therefore the new date field (on the new row) isn’t linked to the JQuery DatePicker.
One quick fix is to have the JavaScript declaration within the row itself, therefore when it’s duplicated it re-initialises the JQuery DatePicker to the new field.
So instead of using this:
$this->insert_jsYou add the code manually after the text field similar to this:
$output .= $SD->text($field_name, $value, array('maxlength' => '30', 'style' => 'datepicker', 'width' => '140px'));
$output .= '[removed]
$(function() {
$(".ff-ft .datepicker").datepicker({
dateFormat: "'.$dateFormat.'"
});
});
[removed]';Edit: The [removed] bits are the script declarations Note: I say similar to this code, as this is copied from my extension, so won’t work “as is” in the extension code in this thread.
There’s still an issue I need to resolve, in that the above displays the datepicker, but alas always populates the first date field. Once I’ve resolved it I’ll post the extension in a separate thread.
Hey Twobelowzero - please do still think about publishing your FT - esp if it’s usable without hacking the FF matrix js as my one depends on. This was never intended to be a “release” thread - it just started as me asking for help to get my version to work.
I’m not planning on doing any further work on my version until 2.0 is out and it’s not really in a usable form at the moment so your version would probably be welcomed…
I’m holding off because I want to add user configurable date formats and styling etc but don’t have time at the mo
Full details of the extension here.
It has date formatting and themeing built in, so hopefully will be useful to you.
Need to add displaying multiple months next 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.