I have created a form and need a bit of help with my javascript? My for is created using HTML and its using media surface. The form is set up to submit to an email. the problem is I have a drop down for GBP or percentage and then a box to type in the amount. When the results display in the email the are showing on a seperate line but I want this to appear together like GBP 5.00 or Percentage 9
Here is what ive got:
Form field
[HTML]<TR>
<TD class="tableBackLgtBlue2">EMPLOYER CONTRIBUTION</td>
<td class="tableBackLgtBlue2"><select size="1" name="sel13A_Type">
<option value="">Select</option>
<option value="GBP">GBP</option>
<option value="Percent">Percent</option>
</select>
<input type="text" name="txt13_Employer_Contribution">
</td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">EMPLOYEE CONTRIBUTION</td>
<td class="tableBackLgtBlue2"><select size="1" name="sel14A_Type">
<option value="">Select</option>
<option value="GBP">GBP</option>
<option value="Percent">Percent</option>
</select>
<input type="text" name="txt14_Employee_Contribution">
</td>
</tr>
[/HTML]
This is the javascript Ive tried to create so the results will appear on the same line but its not working.
Expand|Select|Wrap|Line Numbers
- var x=document.getElementById("sel13A_Type");
- alert(x.selectedIndex);
- //Add GBP to Employer Contribution
- if(x.selectedIndex==1){
- f.txt13_Employer_Contribution.value= "GBP" + f.txt13_Employer_Contribution.value;
- }
- else if(x.selectedIndex==2){
- f.txt13_Employer_Contribution.value= "Percent" + f.txt13_Employer_Contribution.value;
- }
- else
- {
- alert("You must select Percent or GBP");
- return false;
- }
- f.txt14_Employee_Contribution.value= oForm.sel14A_Type.value + f.txt14_Employee_Contribution.value;
- processForm(f);
- return true;
- }
- function processForm(oForm)
- {
- oForm.txt13_Employee_Contribution.value = oForm.sel13A_Type.value + oForm.txt13_Employee_Contribution.value;
- oForm.txt14_Employee_Contribution.value = oForm.sel14A_Type.value + oForm.txt14_Employee_Contribution.value;
- }
Any ideas???