Pages

23 August, 2012

Removing HTML tags from Drop Down list

Hi people, got another tweak to show you.

Following a previous post Filtering lookup columns I've noticed that the selected value of a DropDown list shows HTML tags like this:


Nevertheless the items in the dropdown list are ok.


The question is, how to remove the HTML tags from the selected value?


1. Edit the form in Sharepoint Designer and Split the view
Now click on your DropDown list control, the code window should now pointing to the DropDown source code.


2. Edit the selectedvalue tag
You can now see that the tag selectedvalue is pointing to the Field Name, in my case "Tabela1".

selectedvalue="{@Tabela1}"

What you have to do is just changing this part of the code to

selectedvalue="{substring-before(substring-after(@Tabela1, '>'), '<')}"

And voilá save the form and try it out.

Just one note "Tabela1" is the field name, just change it to your case.

If you want to keep in touch, feel free to Subscribe to How I did it - Sharepoint Foundation 2010