I am completely new to client side scripting and am a little lost.
I have a user filled form with 13 dropdown lists - the user can pick a maximum of eight values out of the possible 13 dropdowns. I am able to capture the values using document.getElementById("form_line_0_1_1").value, what I am looking to do is to create 8 different variables that I can then use to reformat the text based upon the users selections.
Any help or direction would be greatly appreciated.
Steve
3 Replies - 364 Views - Last Post: 16 May 2012 - 10:25 AM
#1
How to grab values that are greater > '' and make new vari
Posted 15 May 2012 - 12:41 PM
Replies To: How to grab values that are greater > '' and make new vari
#2
Re: How to grab values that are greater > '' and make new vari
Posted 15 May 2012 - 12:45 PM
Moved this to Javascript, where you'll probably get better results.
#3
Re: How to grab values that are greater > '' and make new vari
Posted 16 May 2012 - 06:28 AM
I was hoping someone might be able to help me - I know how I would do it server side but that is not an option in this case. But it appears that I have to write some complex code to get it to work. Basically it the first dropdown is selected then it becomes var1 if not look to the second dropdown and see if it has been selected to become var1 and so on. Seems more complex than it needs to be.
Any help or insight would be appreciated,
Steve
if(document.getElementById("pdf_line_0_1_1").value > '') { var var1 = document.getElementById("pdf_line_0_1_1").value }
if (var1 > ''){ var var2 = document.getElementById("pdf_line_0_1_2").value } else { var var1 = document.getElementById("pdf_line_0_1_3").value }
Any help or insight would be appreciated,
Steve
#4
Re: How to grab values that are greater > '' and make new vari
Posted 16 May 2012 - 10:25 AM
OK - now I kind-of get it - I can use an array to capture the values and then format the array values but I am stuck again.
My elements are incremented like this:
document.getElementById('pdf_line_0_1_1').value
document.getElementById('pdf_line_0_1_2').value
document.getElementById('pdf_line_0_1_3').value
so the line
gives me the element name and not the value
How can I get the value
Steve
output = [];
for (var i = 1; i <= 13; i++ ) {
output[i] = "document.getElementById('pdf_line_0_1_" + i + "').value";
document.write(output[i] + "\n")
}
My elements are incremented like this:
document.getElementById('pdf_line_0_1_1').value
document.getElementById('pdf_line_0_1_2').value
document.getElementById('pdf_line_0_1_3').value
so the line
output[i] = "document.getElementById('pdf_line_0_1_" + i + "').value";
gives me the element name and not the value
How can I get the value
Steve
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|