-
- 15 Posts
Hi everybody,
I have trouble with my select box, using webloginPE.
In a form, i have
<label id="wlpeInvestorTypeLabel" for="wlpeInvestorTypeLabel"><span class="required">*</span> Investor type
<select id="wlpeInvestorTypeLabel" name="investorType">
<option value="Family office">Family office</option>
<option value="Private bank">Private bank</option>
<option value="Investment advisor">Investment advisor</option>
<option value="Pension fund">Pension fund</option>
<option value="Endowment">Endowment</option>
<option value="Other">Other</option>
</select>
</label>
i select a value, but i have an error in my form, it’s ok.
but when the form reload, the value of my select disappear, i have the first option of value...
Can you help me ? Thanks a lot
-
- 15 Posts
Hi it’s ok for me, i’ve used javascript.
If somebody is interested, i show the "complicate" solution.
Bye !
-
- 15 Posts
function getOptionValueInvestor(obj){
index = document.wlpeUserRegisterForm.investorType.selectedIndex;
document.wlpeUserRegisterForm.selectedProfil.value=index;
}
function loadSelected(){
document.getElementById("investorTypeId").selectedIndex = document.wlpeUserRegisterForm.selectedProfil.value;
}
<input type="hidden" name="selectedProfil" value="[+post.selectedProfil+]" />
<select id="investorTypeId" name="investorType" onChange="getOptionValueInvestor(this);">
<option value="Family office">Family office</option>
<option value="Private bank">Private bank</option>
<option value="Investment advisor">Investment advisor</option>
<option value="Pension fund">Pension fund</option>
<option value="Endowment">Endowment</option>
<option value="Other">Other</option>
</select>
<script type="text/javascript">loadSelected();</script>