struggling to work out what the xpath expression should be
under the root I have a content node called MetaData, with another called Years beneath it, and then a list of valid years the user can choose beneath that (eg 2007; 2008; 2009 etc) -
i want the xpath checkbox list to list all these years
I saw your tweet from earlier today about the year range in the Umbraco date-picker datatype. Not sure if this forum thread originated because you wanted to bypass that limitation, but I just wanted to chip in with a way to modify the year range in the built-in umbraco datatype as it's quite easy.
Basically the calendar picker used by Umbraco is powered by jQuery UI. So open up 'umbraco_client > ui > jqueryui.js' and find where it says:
yearRange: "-10:+10"
Just modify this to your requirements, e.g. "-100:0" if you're using it for date of birth. You'll then probably need to delete the client dependency cache (App_Data > TEMP > ClientDependency) and restart your app pool, but that should then give you a more appropriate range. It's worth noting, an Umbraco patch release requires that you overwrite the umbraco_client folder, so this hack will not persist across point releases.
I'm not sure of the reason the range is so limited to begin with but I suspect it's just the default out-of-the-box jQuery UI range, to keep the drop-down neat.
Thanks Dan - that wasn't the reason - just that what i'm doing on this new project is a bit date focussed!
However that's a brilliant solution.
I suspect this could be your first package (that is unless I'm being rude and presumptious) happy to code it if you make me a collaborator :-p
Actually though I am not sure if this is packagable - I'm not sure a package should overwrite the client folder. However there must be a simple way.
Would be nice (and should be relatively easy) to make the date range configurable in the data type editor. I can see how a site focussing on dates of birth for a basketball junior league site could want different ranges to a history society.
An experienced package developer may offer a solution. Maybe one who is too busy with their multifluous package developments... and wants to guide a youung grass-hopper :D
Thanks though - even if none of the above works you've given me a great solution to the problem :)
The thing with the date picker is that Umbraco already has done... on a content node, if you look at the "Publish at" / "Remove at" fields (on Properties tab), that control as a dropdown for the Years. Not sure what the data-type version does, (I'll go check after this post).
Either way, it wouldn't be difficult to create a new data-type based on this.
Also, let's say, *if* there were a CodePlex ticket for it, it might even be fixed in the core? ;-)
xpath example with xpath checkboxlist
struggling to work out what the xpath expression should be
under the root I have a content node called MetaData, with another called Years beneath it, and then a list of valid years the user can choose beneath that (eg 2007; 2008; 2009 etc) -
i want the xpath checkbox list to list all these years
it will always be from the root
any pointers? :)
Hi John,
Thinking it would be something like...
Guessing the last part could be "Year"? ;-)
Cheers, Lee.
yep that is probably what i would have expected to work
just checking...
MetaData & Years these are my node names not my data types
is there an easy way to debug this
does the fact that they are in the absolute root cause any issue?
Hi John,
What are the aliases for the MetaData and Years document-types? Guessing that they aren't the same as the node names?
Thanks, Lee.
XML in /appdata/umbraco.config looks like this
Could it be some kind of reserved word issue?
>What are the aliases for the MetaData and Years document-types?
err one of them is
is that bad?
OK, let's try this...
Cheers, Lee.
sorry will actually answer the question this time (a mans got to earn a little karma when he can!)
So
NodeNameDocumentType
MetaDataMetaData
YearsMetaDataType
2007; 2008MetaDataItem
ahaaa - of course - i suspected i was being a bit daft - ooops
presumably if i had more than one MetaDataType and I wanted to only have years
it would be something like
Very close... small correction - change the "name()" to "@nodeName":
or maybe
name() obviously is totally wrong :-$
if you ever decide to write "The Idiots Guide to XPATH in Umbraco"
I know a good idiot you could test it on :D
Hi John,
I saw your tweet from earlier today about the year range in the Umbraco date-picker datatype. Not sure if this forum thread originated because you wanted to bypass that limitation, but I just wanted to chip in with a way to modify the year range in the built-in umbraco datatype as it's quite easy.
Basically the calendar picker used by Umbraco is powered by jQuery UI. So open up 'umbraco_client > ui > jqueryui.js' and find where it says:
Just modify this to your requirements, e.g. "-100:0" if you're using it for date of birth. You'll then probably need to delete the client dependency cache (App_Data > TEMP > ClientDependency) and restart your app pool, but that should then give you a more appropriate range. It's worth noting, an Umbraco patch release requires that you overwrite the umbraco_client folder, so this hack will not persist across point releases.
I'm not sure of the reason the range is so limited to begin with but I suspect it's just the default out-of-the-box jQuery UI range, to keep the drop-down neat.
I have no idea if this helps you :)
Dan
Thanks Dan - that wasn't the reason - just that what i'm doing on this new project is a bit date focussed!
However that's a brilliant solution.
I suspect this could be your first package (that is unless I'm being rude and presumptious) happy to code it if you make me a collaborator :-p
Actually though I am not sure if this is packagable - I'm not sure a package should overwrite the client folder. However there must be a simple way.
Would be nice (and should be relatively easy) to make the date range configurable in the data type editor. I can see how a site focussing on dates of birth for a basketball junior league site could want different ranges to a history society.
An experienced package developer may offer a solution. Maybe one who is too busy with their multifluous package developments... and wants to guide a youung grass-hopper :D
Thanks though - even if none of the above works you've given me a great solution to the problem :)
High 5! YOU ROCK! :-p
One other thing... and a desperate attempt to earn another karma point [they mean more to you when you have less :) ]
I installed the skiltz date picker package - and that was actually worse, in that you could only go back a year by clicking back 12 months
So to get back to 13/1/1972 would have involved 12x40+4 clicks! The first entry I had to do was in 1959 so needless to say I didn't try it :)
But there is a really nice implementation in it for setting the time with two sliders for hours and minutes.
Three sliders to get century, decade, and final year digit would be really neat UI.
Now I'm no front - end UI guru - but you are mine... so do you think that would be possible?
Dammmit - you all just rock SO hard! :)
[and thank you for all the help today too]
The thing with the date picker is that Umbraco already has done... on a content node, if you look at the "Publish at" / "Remove at" fields (on Properties tab), that control as a dropdown for the Years. Not sure what the data-type version does, (I'll go check after this post).
Either way, it wouldn't be difficult to create a new data-type based on this.
Also, let's say, *if* there were a CodePlex ticket for it, it might even be fixed in the core? ;-)
Cheers, Lee.
Ha-ha, I like your style Mr K! http://umbraco.codeplex.com/workitem/30804
voted too :)
is working on a reply...