User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 397,769 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,483 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 4253 | Replies: 1
Reply
Join Date: Nov 2004
Posts: 12
Reputation: beckerc is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
beckerc beckerc is offline Offline
Newbie Poster

using variable for dynamic from elements

  #1  
Nov 16th, 2004
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2004
Posts: 12
Reputation: beckerc is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
beckerc beckerc is offline Offline
Newbie Poster

Re: using variable for dynamic from elements

  #2  
Nov 16th, 2004
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:22 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC