Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Inserting Drop Down Selector via HTML

Go to End

3 Posts   752 Views


Community Member, 38 Posts

8 June 2013 at 3:27am

Edited: 08/06/2013 3:27am

I am attempting to insert a drop down selector on a page within the CMS.
I've tried using the HTML Source Editor on the page but with I click "Update" it strips out my code.

My plan was to use this as a way to navigate to anchor tags within an FAQ page without listing out all of the questions at the top of the page as links.

I was using code like this:

<select name="selectionField">
<option value="Question 1" ><a href="#quest1"Question One</a></option>
<option value="Question 2" ><a href="#quest2">Question Two</a></option>
<option value="Question 3" ><a href="#quest3">Question Three</a></option>

Any help will be greatly appreciated.



Community Member, 38 Posts

12 June 2013 at 3:10am

I'm still trying to figure out how to get this on a page without the system stripping out the code.

This code works in a stand-alone webpage:

<select name="faqForm" ONCHANGE="location = this.options[this.selectedIndex].value;">
<option value="#">Select Your Question</option>
<option value="#quest1">Question One</option>
<option value="#quest2">Question Two</option>
<option value="#quest3">Question Three</option>
<option value="#quest4">Question Four</option>
<option value="#quest5">Question Five</option>

However, when I go into the HTML Source Editor (within the content area for the page) and type the above code in - the system strips it out as soon as I click Update. It converts it to this:

<p>Select Your QuestionQuestion OneQuestion TwoQuestion ThreeQuestion FourQuestion Five</p>

Is there a trick to getting the system to leave my code as is?



Community Member, 343 Posts

12 June 2013 at 3:49am

What you're looking for is "valid_elements" and "extended_valid_elements", options of tinyMCE.

You can set this options with:


But I have to tell you: what you want to do is actually a bad idea. Especially the additional "form" tags in your code.

You could simply write a method in your page class, which seeks your anchor tags in $this->Content() and return them as a DropdownField for the template.