Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-05-19 02:47:47
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
glz_custom_fields: Date Picker
I know that gerhard has this listed for the next version (possibly) but I am wondering if anyone has combined a Date Picker with the custom fields they have formed with this plug in.
I have added a Date Picker before using jmd_admin_js but thus far I have been unable to get it to work with Gerhard’s plug in.
progre55
Offline
Re: glz_custom_fields: Date Picker
Hi proge55,
I’ve not tried it, or gerhard’s most recent version yet, so these are just guesses. Maybe they help:
- Have you checked you have the right id name for the custom field in your jquery code (they are not quite the same as the normal ones)?
- Another reason might be that as glz_custom_fields are also added using javascript just before the end of the page source (in the old version), the date picker would need to be appended to the field after the glz_custom_fields have loaded.
TXP Builders – finely-crafted code, design and txp
Offline
#3 2009-05-19 12:06:13
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: glz_custom_fields: Date Picker
Jakob:
I think I have used the right name …. I have tried multiple variations from (“custom_1” to “custom_1_set” to the actual name of the field”) with no luck.
Regarding adding the picker after his plug in has loaded, do I do that with the plug in order or do I tack it on to the end of his plug in and ifg the latter how do I get the refrences of the jqwery libraries to associate.
The strange thing is that I have two similar sites running the same plug ins except for Custom field. So I belive it is Gerhrad’s plug in that is causing the niggle, but I can’t even get the date picker to attach to the article published date which I thought would be outside his plug in … unless there is a conflict I am overlooking ….
Thanks.
progre55
Offline
Re: glz_custom_fields: Date Picker
I’ve not tried gerhard’s newest version yet (that he released in the last few weeks), so I’m not sure if it works the same way as the old one (1.1.3). If you look at the source code of the write pane, you can see the jquery that removes the standard custom fields and inserts the new ones right at the bottom of the page. You can also use this to identify the exact id# of the new custom fields for targeting with the date picker.
If you don’t mind hacking the plugin, you could try adding your jquery datepicker call at the end of the function glz_custom_fields_replace
after the line that outputs $out
and before the });
that closes the collection of jquery statements, instead of in the head area. You will still need to load your datepicker .js file in the head first, though.
TXP Builders – finely-crafted code, design and txp
Offline
#5 2009-05-20 13:12:14
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: glz_custom_fields: Date Picker
jakob:
I thought I had an idea, but was unsuccesful …
how can I load the datepicker.js file in the head of the admin page ….
also, is this the line you would put the date picker after:
// let's initialize our output
$out = '';
Thanks.
progre55
Offline
Re: glz_custom_fields: Date Picker
No. Sorry, I should have been more clear, just no time to try it myself at the moment:
Just before the end of the function function glz_custom_fields_replace
there’s a section like this
echo
'<script type="text/javascript">
<!--//--><![CDATA[//><!--
$(document).ready(function() {
// removes all existing custom fields
$("p:has(label[for*=custom-])").remove();
$("p:has(label[@for=override-form])").after(\''.$out.'\');
YOUR DATEPICKER HERE
});
//--><!]]>
</script>';
My suggestion would be to insert your $("#targeted-field-id-here").datepicker('your-settings-here');
(or whatever) directly before the line });
, i.e. after the new old custom fields have been removed and the new one’s inserted. Of course, you’ll need to have loaded the datepicker.js in the HEAD area first.
There may be an easier way of loading it in the head if you can somehow make sure your datepicker loads after the custom fields have been changed. gerhard uses $(document).ready(function()...
in his function to make sure it’s only executed once the whole page has loaded. Most jquery functions in the header also do that, but maybe there’s a way of telling them in which order they should be executed. Dunno if there’s a standard load order, but seeing as gerhard’s comes right at the end of the page source I guess it would normally be executed last (hence my hack suggestion above to tag onto the end of his). Maybe someone more expert in jquery can give us a tip.
BTW: if when you get it working, please report how.
EDIT: the above is for v 1.1.3. I just had a look at the source of 1.2 and that section of code is a little longer. The same principle should apply, though, as the new jquery functions that follow only pertain to radio buttons.
Last edited by jakob (2009-05-20 15:12:25)
TXP Builders – finely-crafted code, design and txp
Offline
#7 2009-05-20 16:06:20
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: glz_custom_fields: Date Picker
Folks
This line from glz_custom_fields …
$("p:has(label[@for=override-form])").after(\''.$out.'\');
…won’t work with v1.3 of jquery or later. If you are running a newer version of jquery just edit the plugin and change it to…
$("p:has(label[for=override-form])").after(\''.$out.'\');
NB: lack of ‘@’ character.
Repeat on other occurrances of ‘@’ in the js code and and all will magically start working again.
— Steve
Offline
#8 2009-05-21 04:47:19
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: glz_custom_fields: Date Picker
Jakob:
I have tried numerous combinations using the Date Picker script and get parse errors on every try.
I was able to add other code in this location to move the custom fields around the page – so that was good.
I figured at the minimum I would be able to add the code without error, even if it did not work.
Any further assistance would be helpful.
Thanks.
progre55
Offline
Re: glz_custom_fields: Date Picker
Hey guys, I just came up with glz_custom_fields v1.2.1 which adds special custom field support. The first one is the Date Picker, others will follow as and when. I’m letting progre55 taking it for a spin before submitting it to the community. Stay tuned!
Offline
#10 2009-06-04 16:39:51
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: glz_custom_fields: Date Picker
Everyone:
You are going to be impressed with the datePicker functionality. Although not earth shattering (since everyone is use to using them on the web), the ability for you as a (designer/programmer) to add it into your TXP arsenal I think further enhances the ability to give your end users a really intuitive backend and will limit mistakes on data entry.
I have tested what Gerhard has done and provided comment and feedback. I am guessing that in the near future he will be releasing it out to everyone.
You will not be disappointed.
progre55
Offline
Re: glz_custom_fields: Date Picker
Sounds good, thanks to both of you for the info!
TXP Builders – finely-crafted code, design and txp
Offline
Re: glz_custom_fields: Date Picker
On the same subject, glz_custom_fields v1.2.4 will have Time Picker support as well. There are a few more tasks to accomplish, but this will be a really good release once it’s done.
Offline
Pages: 1