Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check object name existence

Status
Not open for further replies.

foxbox

Programmer
Sep 11, 2000
1,052
NL
My ASP program creates a random number of INPUT fields (i do not know the number in advance). The fields have a sequential name, like "F1", "F2", "F3", etc. After SUBMIT every field with a value must be processed.
So my program must check document.form.f1.value up to and including document.form.f??.value. . .
how?

(one alternative is to put a hidden field in the form with the maximum fieldnumber; but is there a more elegant way?) br
Gerard
(-:
 
I think you have the right idea with the hidden field unless you want to scan the raw input looking
Code:
DIM I
DIM J
FOR I = 1 TO 32767
    J = Instr(raw,"F" & CStr(I) & "=" ,1) ' Text Compare
    IF J = 0 Then Exit For
    ' process data
NEXT
I've been working on desktop to IBM Mainframe for a while so I disremeber how to access the raw input in ASP but it is there somewhere in the REQUEST object.
 
My own alternative is workable. I looked into document.all and now i have a lot of new ideas, but that's for later.
br
Gerard
(-:
 
Maybe the following JavaScript helps:

Code:
	var frm = document.frmINPUT;

	for (i=0;i<frm.elements.length;i++)
	{
		e = frm.elements[i];

		if (e.type=='checkbox') {
			...
		}
		if (e.type=='text') {
			...
		}
	}

bg
Juan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top