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!

Dynamic Form Validation Question 1

Status
Not open for further replies.

PoppapumpJ

Programmer
Dec 17, 2001
86
US
OK, my first page asks for the number of items in a package.

The next page dynamically builds title and description input boxes for the number of items.

on The next page, I want to validate that they are not empty. Is there a way to dynamically generate the ASP.

Example
_________________________________________
iCounter = 1
While iCounter <= cInt(Request.Form(&quot;NumOfItems&quot;))
if Request.Form(&quot;ItemTitle&quot; & iCounter) = &quot;&quot; then
Response.Write &quot;You must input a Title&quot;
Response.End
end if
iCounter = iCounter + 1
WEnd
___________________________________________________
I guess the problem is that there needs to be a &quot; after iCounter.

anybody got any suggestions?

Thanks
 
if Request.Form(&quot;ItemTitle&quot; & iCounter & &quot;&quot;) = &quot;&quot; then
 
You don't need the &quot; after the iCounter. What you have posted looks like perfectly valid code to me.

A few questions:
(1) What error is it returning? Or is it just always hitting the response.end?

(2) Why not do the form validation on the client side before you submit? Might be a little easier on your server.

Aside of that, I would triple check my variable spelling, because like I said, what you posted looks perfectly valid.

:)
paul
penny.gif
penny.gif
 
Thanks guys.
if Request.Form(&quot;ItemTitle&quot; & iCounter & &quot;&quot;) = &quot;&quot; then

That worked.

Link9.

I considered using client side, but I't not that familiar with it and there should't be too many users on this server.

I have marked JavaScript down as the next thing I am to learn.

Thanks again
 
yeah, link9, you're right. the ending &quot;'s aren't needed. don't know why i thought they were....


poppapumpj - are you saying you have 3 separate pages? first page asks for number of items, next page is input form asking for item title of each item, then 3rd page validates that each item title entered? if so, you're probably losing the value of number of items. need to carry that through to the 3rd page in a hidden input field or something.
 
Yeah, I got am passing those through hidden input fields..

After it validates everything it writes it to the DB.

Probably not the most effecient way, but the user is not very web savvy and I wanted to present it in a Wizard format.

Thanks guys
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top