By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,434 Members | 2,902 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,434 IT Pros & Developers. It's quick & easy.

Form Results to display in order when submitting to an email

P: 24
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


<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>

<input type="text" name="txt13_Employer_Contribution">




<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>

<input type="text" name="txt14_Employee_Contribution">



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
  1. var x=document.getElementById("sel13A_Type");
  2.    alert(x.selectedIndex);
  4.    //Add GBP to Employer Contribution
  5. if(x.selectedIndex==1){
  6. f.txt13_Employer_Contribution.value= "GBP" + f.txt13_Employer_Contribution.value;
  8. }
  9. else if(x.selectedIndex==2){
  10. f.txt13_Employer_Contribution.value= "Percent" + f.txt13_Employer_Contribution.value;  
  11. }
  12. else
  13. {
  14. alert("You must select Percent or GBP");
  15. return false;
  16. }
  18.    f.txt14_Employee_Contribution.value= oForm.sel14A_Type.value + f.txt14_Employee_Contribution.value;  
  20.    processForm(f);
  21.    return true;    
  22. }
  26. function processForm(oForm)
  27. {
  31.     oForm.txt13_Employee_Contribution.value = oForm.sel13A_Type.value + oForm.txt13_Employee_Contribution.value;
  32.     oForm.txt14_Employee_Contribution.value = oForm.sel14A_Type.value + oForm.txt14_Employee_Contribution.value;
  35. }

Any ideas???
Sep 19 '07 #1
Share this Question
Share on Google+
4 Replies

Expert Mod 15k+
P: 16,027
Please use code tags when posting code, e.g.

Javascript code goes here

When sending to email using the form action attribute, you are at the mercy of the browser and depending on the user's email software. The proper way would be to use a server-side script.
Sep 19 '07 #2

Expert Mod 15k+
P: 16,027
Added more information to the thread title.
Sep 19 '07 #3

P: 24
Anyone any ideas on this problem?
Sep 20 '07 #4

Expert Mod 15k+
P: 16,027
You could try removing the select elements once you've updated the text box.
Sep 20 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.