954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

using variable for dynamic from elements

I do not know if this is even possible in this language, but here goes:

I am looping a recordset that has been returned for update. the problem is I have many records that can be returned, so when i submit my form, I get an error because it does not know what form elements to use. I used to use this method in coldfusion where I would apply a variable to the end of my form elelmets so they would all be uniquely named, thier form name + the incremt variable so it would give you textbox1 or textbox5.

Now here is the problem. I want to go from the many variables down to a single variable. my plan is to have a function in the on click method that sets the increment to the current row number. I then have a javascript funtion in my onsubmit method that takes this increment to set the single form element = to that value. doe this make sense? can it be done?

here is some sample code

jsIncrement = 0;

this is my on click function where ipass in the variable value and it works //fine

function setIncrement(num){
jsIncrement = num;

}

this is where I wish to set the standard form element = to the dynamic form elelemnt but do not know how...or if it can be done

function selectForUpdateSubmit() {

document.process_form.action.value = "SU";
document.process_form.prod_usage_id.value = document.process_form.upd_prod_usage_id+jsIncrement.value;
document.process_form.submit();
}

any help or suggestions are most appreciated.

beckerc
Newbie Poster
12 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

After posting this. it occured to me that rather than passing the increment to try and translate a dynamic form element, i could simply pass the primary key for the row needed and then set the single element equal to that value :o

missing the forest for the trees sometimes.

beckerc
Newbie Poster
12 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You