Hi Richard,

Thanks for that, but I'm not sure that will give the result I'm looking
for.  I'm looking to get "A" back if I already have "123", not get "123" if
I pass in "A".

The issue I've got is that I have one Option List in my Content Class with
things like:

Name = Value
----------------------
Page A = /pathToA
Page A with extras = /pathToAWithExtras
Page B = /pathToB
Page C = /pathToC
Page C with extras = /pathToCwithExtras

And I'd just like a bit of PHP which knows what Name's Option the user
chose on that page so that I can check to see if it was an option "with
extras".  The values don't have a particular convention nor can I really
enforce one, so I don't want to test that.

So will the StringDictionary do a reverse lookup and return a name if I
pass it a value?

Cheers,
Chris.

On 19 December 2011 23:22, Richard Hauer <[email protected]> wrote:

> There might be an order of execution problem going on here, as in it is
> evaluating the objectleaders in the wrong order.  try putting a normal
> placeholder for the opt into the indexer in place of String:A
>
>
>
> Regards,
> Richard.
>
> Sent from my mobile. Sorry if it's brief.
>
>
> -------- Original message --------
> Subject: Re: Getting the name of currently selected item in option list
> From: Chris Jamieson <[email protected]>
> To: "[email protected]" <[email protected]>
>
> CC:
>
>
>  Hi Richard,
>
>  I'm not sure I totally follow you, I'm still a bit fresh as a RedDot
> developer.
>
>  I've created a test content class to play around a bit further.  It's
> just got a simple HTML template and an option list called opt_test with
> following values:
>
>  A = 123
> B = 456
>
>  So in my tests:
>
>  <%!!
> Context:CurrentPage.Elements.GetElement(opt_thankyou_and_error).OptionList
> !!%>
>
>  Gives:
> System.Collections.Specialized.StringDictionary
>
>  <%!!
> Context:CurrentPage.Elements.GetElement(opt_test).OptionList[String:A] !!%
> >
>
>  Gives:
> 123
>
>  <%!!
> Context:CurrentPage.Elements.GetElement(opt_test).OptionList[String:123] !!%
> >
>
>  Gives:
> <nothing...>
>
>  <%!!
> Context:CurrentPage.Elements.GetElement(opt_test).OptionList[Context:CurrentPage.Elements.GetElement(opt_test).Value]
> !!%>
>
>  Gives:
> <nothing...>
>
>  <%!!
> Context:CurrentPage.Elements.GetElement(opt_test).OptionList[String:Context:CurrentPage.Elements.GetElement(opt_test).Value]
> !!%>
>
> Gives:
> <also, nothing...>
>
>  So to me it looks like passing the name to the StringDictionary just
> results in the corresponding Value, but not the other way round which is
> what I'm looking for...
>
>  Any other thoughts?
>
>  Thanks so much for your suggestions so far, much appreciated!
>
>  Cheers,
> Chris.
>
> On 19 December 2011 14:40, Richard Hauer <[email protected]> wrote:
>
>> Is "opt_thankyou_and_error" a string or a placeholder. If its a string
>> you need to write it as
>>
>>  String:opt_thankyou_and_error
>>
>>
>> Regards,
>> Richard.
>>
>> Sent from my mobile. Sorry if it's brief.
>>
>>
>>
>> -------- Original message --------
>> Subject: Re: Getting the name of currently selected item in option list
>> From: Chris Jamieson <[email protected]>
>> To: "[email protected]" <
>> [email protected]>
>> CC:
>>
>>
>>  Hi Richard,
>>
>>  Thanks for getting back to me!
>>
>>  Unfortunately the code you suggested in a render tag didn't seem to
>> return anything for me.
>>
>>  Can I ask, is there some documentation describing the tags?  I've just
>> been checking Markus Giesen's Unofficial RedDot CMS blog :
>> http://www.reddotcmsblog.com/reddot-cms-render-tags-the-ultimate-list
>>
>>  And trying to make a bit of a leap from a RedDot RQL guide we have, but
>> I'd really rather not use RQL for this.
>>
>>  The exact code I used to test was:
>>
>>  <p>
>> <%!!
>> Context:CurrentPage.Elements.GetElement(opt_thankyou_and_error).OptionList[Context:CurrentPage.Elements.GetElement(opt_thankyou_and_error).Value]
>> !!%>
>> </p>
>>
>>  Cheers,
>> Chris.
>>
>> On 19 December 2011 12:06, Richard Hauer <[email protected]> wrote:
>>
>>> Try this:
>>>
>>>
>>> Context:CurrentPage.Elements.GetElement(opt_test).OptionList[Context:Current
>>> Page.Elements.GetElement(opt_test).Value]
>>>
>>> The OptionList Property is of type StringDictionary, and is a member of
>>> the
>>> PageElementOptionList which is what is being returned by the GetElement()
>>> method (in the case of an Option List anyways).
>>>
>>> You might need to jiggle the notation if your default language is VB and
>>> not
>>> C#, but essentially you're trying to pass the value as an indexer
>>> parameter
>>> to the Element itself.
>>>
>>> Regards,
>>> Richard Hauer
>>> Solution Architect
>>> Level 4, 263 Clarence Street, Sydney NSW 2000
>>> p +61 2 9321 1555 | d +61 2 9321 1556 | m +61 414 189 170
>>>
>>> -----Original Message-----
>>> From: [email protected]
>>> [mailto:[email protected]] On Behalf Of ChrisJ
>>> Sent: Monday, 19 December 2011 10:42 PM
>>> To: RedDot CMS Users
>>> Subject: Getting the name of currently selected item in option list
>>>
>>> Hi folks,
>>>
>>> Does anyone here know how to output the name, not the value, of the
>>> currently selected item from an option list in a template?  To get the
>>> value
>>> is trivial, either just reference the element:
>>>
>>> <%opt_test%>
>>>
>>> or use a render tag:
>>>
>>> <%!! Context:CurrentPage.Elements.GetElement(opt_test).Value !!%>
>>>
>>> I've tried educated guessing (looking at the RQL) by using:
>>>
>>> <%!! Context:CurrentPage.Elements.GetElement(opt_test).Value.Name !!
>>> %>
>>>
>>> or
>>>
>>> <%!!
>>> Context:CurrentPage.Elements.GetElement(opt_test).Value.Description !!
>>> %>
>>>
>>> But get nothing...
>>>
>>> Any ideas?
>>>
>>> Cheers,
>>> Chris.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "RedDot CMS Users" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/reddot-cms-users?hl=en.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "RedDot CMS Users" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/reddot-cms-users?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "RedDot CMS Users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/reddot-cms-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "RedDot CMS Users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/reddot-cms-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "RedDot CMS Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/reddot-cms-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "RedDot CMS Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/reddot-cms-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"RedDot CMS Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/reddot-cms-users?hl=en.

Reply via email to