I’m trying to create a drop down list that inputs the tag value. So only the selected item in the list is displayed in the ditto call.
The problem with this code is when you select an item out of the list it takes you to url www.mywebsite.com/speaker1(the value selected). so how can I get this to select a value that the ditto call can read?
So far this is my codding:
<FORM name="speaker">
<SELECT name="speakername" id="speakername2" onchange="location = this.options[this.selectedIndex].value;">
<OPTION selected="selected" value="speaker1">speaker1</option>
<OPTION value="speaker2">speaker2</option>
</SELECT>
[!Ditto? &parents=`5` &level=`0` &tpl=`SermonDitto` &display=`10` &paginate=`1` &paginateAlwaysShowLinks=`0` &tagDelimiter=`,` &tagData=`tvSpeaker` &tagMode=`onlyAllTags` &tags=`[+speakername2+]`!]
[+previous+] - [+pages+] - [+next+]
I don’t think speakername will be available as a placeholder.
I think you’ll need to use a snippet tag there as a parameter in the Ditto call instead.
Then in your GetSpeakername snippet:
return $_POST['speakername'];
I guess I’m not clear on what you’re trying to do. AFAIK, when using the JS location=, each option needs to be a URL that the browser will jump to. Do you intend to jump to another page or the current page?
If the Ditto call is on the curent page, it will execute when the page is first visited -- before the user has selected any option.
It needs to be the current page. I just want the form select field to be selecting different options and that value of the selected option become the $tags= parameter for the ditto.
The problem with that is it leads me back to the home page. So I have to change anything is modx to allow added strings in the url?
Thanks all for the help!
I got it! after some searching on modx forums I found out that because I’m not using friendly urls I needed to replace the ? with & so there wasn’t 2 ?...
Thanks Bobray, kp52, and bunk58.
Glad you got it sorted. Thanks for reporting back.