Forum

Thread tagged as: Question, Suggestions, Discussion

Dataselect field type, output options AND values

Hello folks,

I'm not sure if this is possible so I've tagged this post a bit oddly. What I'm trying to do is output both the option and value from a dataselect, if this is possible I'm failing miserably and I may be missing the wood for the trees in the docs and forums.

My use case is this:

I have two list/detail pages, Courses and Locations. I'm now working on an Events page that will let the client select a course and a location via dataselects, add a date and some other details but the price is dictated by the course. I'm craftily pulling this in as a value in the course dataselect but I can't display the name of the course (the option) and the price (the value).

I've tried treating the field a bit like an image, repeating it with different attributes to see if the result changes but to no avail. If this isn't possible, what may be nice is an 'output' attribute on dataselect fields from which you can choose 'option' or 'value'.

Or am I trying to fit a square peg in a round hole? I looked at using the Events app but I don't think it would gain me much as I'm not really after calendar functions etc.

Thanks

Mark Greenwood

Mark Greenwood 0 points

  • 7 years ago

UPDATE: I found the solution to this problem completely by accident when using the docs for something else. Somehow, I didn't know about the AWESOME 'each' attribute on perch_content_custom. With this, I set a slug as my value and used each to get the raw data and extract the name and price from the matching course details. Winner!

Just putting this here on the off-chance anyone has a similar challenge.

Cheers.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Apologies for not getting you a reply on this sooner - I'm not sure how it slipped through! Glad you got it sorted.

No problem Drew, I know you guys are always working hard on updates! I'm kind of happy I found each and figured it out myself. I've used Perch for 2 years now and I'm always learning new ways of doing things. It keeps it interesting.

I'm not sure when 'each' was added but thank you for putting it in there. :)