Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: jmd_admin_js: Run page-specific JS in the backend
Yes, that does it, thank you! Very nice.
This will help a client who despite clear instructions consistently enters the date field with a different format each time causing their events not to show up properly. :-)
TXP Builders – finely-crafted code, design and txp
Offline
#14 2009-02-23 19:16:12
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: jmd_admin_js: Run page-specific JS in the backend
Jim/Jakob:
Could I add a date picker to the Time Stamp and Expirey fields?
progre55
Last edited by progre55 (2009-02-23 19:17:20)
Offline
Re: jmd_admin_js: Run page-specific JS in the backend
I used the jquery ui datepicker and I saw on its demo page that you can also use it to populate an alternate field with a particular date format. Whether you can populate six different fields with their own format I don’t know but theoretically it looks possible. You’ll probably need to target the input boxes via $("input[name=xyz]").datepicker({...});
(off the top of my head so check syntax pls) as they don’t have distinct #ids.
Post back if you get it working as I’m sure it will interest many.
If you have no luck, there are other jquery datepickers too.
Last edited by jakob (2009-02-23 21:35:05)
TXP Builders – finely-crafted code, design and txp
Offline
#16 2009-02-24 14:55:29
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: jmd_admin_js: Run page-specific JS in the backend
jm/jakob:
jm: Thanks for the great plug in.
jakob: Thanks for the guidance. I got the date picker to work perfectly using your original code. When I use the code jm suggested I get a stack overflow message. I have not looked further into this (yet).
Regarding the timestamp/expirey fields you were correct on the targeting, but syntax is $(“input[title=Day]”).datepicker … I have not tried filling the multiple fiedls yet with one entry, but it is the next item on the list …
I will keep you guys updated.
progre55
Offline
#17 2009-02-26 13:11:06
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: jmd_admin_js: Run page-specific JS in the backend
jm/jakob:
Guys I now have the jquery alternate field code working fine too. My current problem is that I need one additional field to populate. When I attempt to modify the code I either break it or I get no functionality. I am continuing to work on it, but was curious if either of you had a suggestions.
I have also come across Kevin Luck’s DatePicker code but this seems to just spit errors at me, so I will continue to tinker with it.
progre55
Offline
#18 2009-03-14 15:09:46
- woof
- Member
- Registered: 2004-08-01
- Posts: 128
Re: jmd_admin_js: Run page-specific JS in the backend
jm: thanks for a really useful plugin
all: I’m interested to learn if progre55 or anyone else has had success with adding a date picker to the Time Stamp and Expiry field sets and if so how did you go about it? — any help or direction would be appreciated. Thanks.
Offline
#19 2009-03-16 18:14:04
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: jmd_admin_js: Run page-specific JS in the backend
woof:
I have gotten it to work (sorta) I can fill two of the three fields using this:
</script>
<link rel="stylesheet" media="screen" type="text/css" href="/js/theme/ui.all.css" />
<script src='/js/jquery-ui-personalized-1.5.3.js' type='text/javascript'></script>
<script type="text/javascript">
// Adds date-picker to Published Date Fields
$(document).ready(function(){
$("input[title=Year]").datepicker({ dateFormat: 'yy', showOn: 'button', buttonImage: '/js/theme/calendar.gif', buttonImageOnly: true, altField: 'input[title=Month]', altFormat: 'mm' });
});
// Adds date-picker to Expired Date Fields
$(document).ready(function(){
$("input[title=article_exp_year]").datepicker({ dateFormat: 'yy', showOn: 'button', buttonImage: '/js/theme/calendar.gif', buttonImageOnly: true, altField: 'input[title=article_exp_month]', altFormat: 'mm' });
});
Because I could not get the third to fill, I turned to Kevin Luck’s Code
I have Kevin’s script up and running, filling in three text fields with a calendar, but I have not integrated it with the published/expired date fields (yet).
Although I should have done it earlier, I am going to attempt to take a crack at it this week.
progre55
Last edited by progre55 (2009-03-16 18:15:35)
Offline
#20 2009-09-25 10:14:52
- mlarino
- Member
- Registered: 2007-06-29
- Posts: 367
Re: jmd_admin_js: Run page-specific JS in the backend
Ok,
Imagine I have no clue of javascript, or php (wich is somewhat true) :)
The documentation on the plugin for me is really confusing.
I will explain what I did:
1- installed jmd_admin_js and stm_javascript and activated both.
2- following the Help of jmd_admin_js I went to the javascript tab in preferences, created a new js file named “article” and pasted this inside:
hideFormEl('article-image');
3- went to see if in my write page the article image was hiden, but ofcourse is still there.
4- scrach my head because I have no clue what I should do next.
can someone help me? :)
Last edited by mlarino (2009-09-25 10:17:28)
Offline
Re: jmd_admin_js: Run page-specific JS in the backend
mlarino wrote:
can someone help me? :)
Did you actually paste the function, hideEl()
, in either the article or default JS fields (the block of code under the heading “JS: default” in the help)? If you just have hideEl(...)
, then you have an undefined function.
Offline
#22 2009-12-17 17:54:22
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: jmd_admin_js: Run page-specific JS in the backend
Why didn’t I discover this plugin before? Very useful, thank you!
Offline
#23 2014-10-13 15:15:41
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,313
Re: jmd_admin_js: Run page-specific JS in the backend
Needs only 2 small changes to work with spf_js instead of stm_javascript:
Search for txp_js
Replace with spf_js
Search for $out[] = base64_decode($row['js']);
Replace with $out[] = $row['js'];
And like with stm_javascript it will take whatever is inside the default JS form and make it available on the entire admin side, except for the plugins panel.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline