Page 1 of 1

(Solved) Formbuilder dropdown value same as optiontext

Posted: Tue May 05, 2015 6:38 pm
by erpee
I've created a dropdown in formbuilder. Output looks like this ...

Code: Select all

<label for="fbrp__63">ext2*</label>
<select class="cms_dropdown" name="cntnt01fbrp__63"  id="fbrp__63">
	<option value="" selected="selected"> Maak uw keuze</option>
	<option value="1">.nl</option>
	<option value="2">.com</option><
/select>
I want the values to be the same as the optiontext.

Code: Select all

	<option value=".nl">.nl</option>
	<option value=".com">.com</option><
/select>
I would like this to be the same so I can use this value in a Javascript using this call:

Code: Select all

var inp1 = document.getElementById('fbrp__63');
var myURL = 'chk.php?dm=www.'  + inp1.value;
How can I change this?

Re: Formbuilder dropdown value same as optiontext

Posted: Tue May 05, 2015 8:20 pm
by 10010110
Then you need to enter the same text in the fields “Option Name” and “Value Submitted”, if I understand you correctly.

Re: Formbuilder dropdown value same as optiontext

Posted: Wed May 06, 2015 5:43 am
by erpee
I've already done that ...
Image

So, that doesn't do the trick ..

Re: Formbuilder dropdown value same as optiontext

Posted: Wed May 06, 2015 7:00 am
by velden
You probably can't change that behavior other than by a feature request.

You could use jQuery to get the text part quickly:

Code: Select all

$("#fbrp__63 option:selected").text()
I don't know the plain javascript code for that.

Re: Formbuilder dropdown value same as optiontext

Posted: Wed May 06, 2015 6:15 pm
by erpee
velden wrote:

Code: Select all

$("#fbrp__63 option:selected").text()
I couldn't get this code to work in my script. A lot more Google-ing gave me the solution:

Code: Select all

var inp1 = document.getElementById('fbrp__63').options[document.getElementById('fbrp__63').selectedIndex].text;