I need to ensure that if a quantity is entered for a product, then a finish and a
package is also selected for that product.

If a quantity is not entered for a product, no finish or package should be selected.

If no quantities are entered, the form should not submit.

PRS is the product recordset. The loop can be 1 to n times.

I think this is gonna take client side scripting, and I've googled 'til I need
glasses, but no joy. And yeah, I know it's a lousy table layout, but pretty isn't
the priority right now.
Thanks,
Mike R

<form method="Post" action="changeact.asp">
<center>
<table width = "969" border="1" cellpadding="4" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" height="104">
<tr>
<input type="hidden" name="UID" value=<%=request.querystring("user")%>>
<%Do while Not PRS.EOF%>
<td width="10" align="left">
<input type="hidden"
name="PID"value=<%=PRS("Prod_ID")%>><%=PRS("Prod_ID")%>&nbsp;</td>
<td width="40" align="left"><%=PRS("Prod_Name")%>&nbsp;</td>
<td width="10" align="left"><%=PRS("Prod_Code")%>&nbsp;</td>
<td width="60" align="left">
<input type="text" name="quantity" size="20">Quantity</td>
<td width="1" align="left">
<select name="finish="3">Finish
<OPTION value=Plain>Plain</OPTION>
<OPTION Value="Brass">Brass</OPTION>
<OPTION Value="Galv">Galvanized</OPTION>
</select></td>
<td width="40" align="left">
<select name="pkg" size="3">Package
<OPTION>Box</OPTION>
<OPTION>Paper bag</OPTION>
<OPTION>Plastic bag</OPTION>
</select></td>
</tr>
<%mrs.movenext
Loop %>
</table>
<p>
<input type="submit" value="Order" name="B1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;<input type="submit" value="Cancel" name="B1">
</form>

Re: Form validation opportunity/challenge by Stefan

Stefan
Fri Jun 03 04:41:06 CDT 2005

Your form will fail any validation script and never submit more than one set of values for the duplicates
You can not have duplicate field names in a form ("quantity" and "finish" and "pkg" repeat 1 to n times)
- plus name="finish="3" is an illegal field name

To make them unique for each record either append a counter (from your looping script) or just the product ID to the field name as
in

<input type="text" name="quantity<%=PRS("Prod_ID")%>" size="20">

You'll find some form validation scripts at http://irt.org/script/form.htm#5
--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


"MikeR" <nf4l@pobox.com> wrote in message news:uNopIy9ZFHA.2496@TK2MSFTNGP14.phx.gbl...
|I need to ensure that if a quantity is entered for a product, then a finish and a
| package is also selected for that product.
|
| If a quantity is not entered for a product, no finish or package should be selected.
|
| If no quantities are entered, the form should not submit.
|
| PRS is the product recordset. The loop can be 1 to n times.
|
| I think this is gonna take client side scripting, and I've googled 'til I need
| glasses, but no joy. And yeah, I know it's a lousy table layout, but pretty isn't
| the priority right now.
| Thanks,
| Mike R
|
| <form method="Post" action="changeact.asp">
| <center>
| <table width = "969" border="1" cellpadding="4" cellspacing="0"
| style="border-collapse: collapse" bordercolor="#111111" height="104">
| <tr>
| <input type="hidden" name="UID" value=<%=request.querystring("user")%>>
| <%Do while Not PRS.EOF%>
| <td width="10" align="left">
| <input type="hidden"
| name="PID"value=<%=PRS("Prod_ID")%>><%=PRS("Prod_ID")%>&nbsp;</td>
| <td width="40" align="left"><%=PRS("Prod_Name")%>&nbsp;</td>
| <td width="10" align="left"><%=PRS("Prod_Code")%>&nbsp;</td>
| <td width="60" align="left">
| <input type="text" name="quantity" size="20">Quantity</td>
| <td width="1" align="left">
| <select name="finish="3">Finish
| <OPTION value=Plain>Plain</OPTION>
| <OPTION Value="Brass">Brass</OPTION>
| <OPTION Value="Galv">Galvanized</OPTION>
| </select></td>
| <td width="40" align="left">
| <select name="pkg" size="3">Package
| <OPTION>Box</OPTION>
| <OPTION>Paper bag</OPTION>
| <OPTION>Plastic bag</OPTION>
| </select></td>
| </tr>
| <%mrs.movenext
| Loop %>
| </table>
| <p>
| <input type="submit" value="Order" name="B1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| &nbsp;<input type="submit" value="Cancel" name="B1">
| </form>



Re: Form validation opportunity/challenge by MikeR

MikeR
Fri Jun 03 09:39:50 CDT 2005

Hi again, Stefan -
As you probably deduced, this post was related to the earlier one. Good suggestion on the
name.

Maybe for validation purposes it won't work but dupe field names are valid for the request
variables. The 3 was a typo, and should have been <select name="finish" size="3">. It was
getting *REAL* sleepy in here <bgrin>.
I'll take a look at the script link.
Thanks for your replies.
MikeR

Stefan B Rusynko wrote:
> Your form will fail any validation script and never submit more than one set of values for the duplicates
> You can not have duplicate field names in a form ("quantity" and "finish" and "pkg" repeat 1 to n times)
> - plus name="finish="3" is an illegal field name
>
> To make them unique for each record either append a counter (from your looping script) or just the product ID to the field name as
> in
>
> <input type="text" name="quantity<%=PRS("Prod_ID")%>" size="20">
>
> You'll find some form validation scripts at http://irt.org/script/form.htm#5

Re: Form validation opportunity/challenge by Stefan

Stefan
Fri Jun 03 10:24:50 CDT 2005

You may think they are valid but I guarantee you are getting incorrect data

Request.Form("quantity") will only ever give you the value of the 1st form field named quantity in the form
(same value for every one of your other records)
- since it is not unique the way you have it now, and ASP (or any other form processor) has no way of knowing which of the other
dupes to even look at (they are just ignored)

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


"MikeR" <nf4l@pobox.com> wrote in message news:OHuPZoEaFHA.900@tk2msftngp13.phx.gbl...
| Hi again, Stefan -
| As you probably deduced, this post was related to the earlier one. Good suggestion on the
| name.
|
| Maybe for validation purposes it won't work but dupe field names are valid for the request
| variables. The 3 was a typo, and should have been <select name="finish" size="3">. It was
| getting *REAL* sleepy in here <bgrin>.
| I'll take a look at the script link.
| Thanks for your replies.
| MikeR
|
| Stefan B Rusynko wrote:
| > Your form will fail any validation script and never submit more than one set of values for the duplicates
| > You can not have duplicate field names in a form ("quantity" and "finish" and "pkg" repeat 1 to n times)
| > - plus name="finish="3" is an illegal field name
| >
| > To make them unique for each record either append a counter (from your looping script) or just the product ID to the field name
as
| > in
| >
| > <input type="text" name="quantity<%=PRS("Prod_ID")%>" size="20">
| >
| > You'll find some form validation scripts at http://irt.org/script/form.htm#5



Re: Form validation opportunity/challenge by MikeR

MikeR
Sat Jun 04 07:15:17 CDT 2005

Stefan -
I solved my problem by giving the option boxes a default value, so all the arrrays have
the same number of elements.

As to the validity of the data, I'm not trying to be argumentative, just trying to
understand.
Below is a result of a response.write request.form statement in the receiving asp page.
Note the repeating names, with different values. This is from a 3 line form. I can access
the values on the recieving page by request.form("PID")(n), request.form("cost")(n) etc.
And in *EVERY* case the data is correct. Can you point out where/why that's not true?

UID=mikey&PID=113&cost=12.00&conditii_de_plata=AVANS&termen_de_livrare=PeStock&baza_livrare=Livrat+la+cumparator&PID=115&cost=&conditii_de_plata=AVANS&termen_de_livrare=In+5+zile&baza_livrare=Livrat+la+cumparator&PID=118&cost=14.95&conditii_de_plata=PLATA%28NR+ZILE%29DUPA+LIVRARE&termen_de_livrare=In+10+zile&baza_livrare=Franco-+furnizor&B1=Bid
MikeR

Stefan B Rusynko wrote:
> You may think they are valid but I guarantee you are getting incorrect data
>
> Request.Form("quantity") will only ever give you the value of the 1st form field named quantity in the form
> (same value for every one of your other records)
> - since it is not unique the way you have it now, and ASP (or any other form processor) has no way of knowing which of the other
> dupes to even look at (they are just ignored)
>

Re: Form validation opportunity/challenge by Stefan

Stefan
Sat Jun 04 07:38:56 CDT 2005

They work because in the sample code you are now showing you have an (n) as part of the query
request.form("PID")(n), etc.
and (n) is probably incremented in each row thru your code
- so each form field name / object is unique

In your original example (different field names) you only had non unique field names repeating in the rows as say <input
type="text" name="quantity" size="20"> w/ no signs of the (n) incremented code

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


"MikeR" <nf4l@pobox.com> wrote in message news:OoowV8PaFHA.1148@tk2msftngp13.phx.gbl...
| Stefan -
| I solved my problem by giving the option boxes a default value, so all the arrrays have
| the same number of elements.
|
| As to the validity of the data, I'm not trying to be argumentative, just trying to
| understand.
| Below is a result of a response.write request.form statement in the receiving asp page.
| Note the repeating names, with different values. This is from a 3 line form. I can access
| the values on the recieving page by request.form("PID")(n), request.form("cost")(n) etc.
| And in *EVERY* case the data is correct. Can you point out where/why that's not true?
|
|
UID=mikey&PID=113&cost=12.00&conditii_de_plata=AVANS&termen_de_livrare=PeStock&baza_livrare=Livrat+la+cumparator&PID=115&cost=&conditii_de_plata=AVANS&termen_de_livrare=In+5+zile&baza_livrare=Livrat+la+cumparator&PID=118&cost=14.95&conditii_de_plata=PLATA%28NR+ZILE%29DUPA+LIVRARE&termen_de_livrare=In+10+zile&baza_livrare=Franco-+furnizor&B1=Bid
| MikeR
|
| Stefan B Rusynko wrote:
| > You may think they are valid but I guarantee you are getting incorrect data
| >
| > Request.Form("quantity") will only ever give you the value of the 1st form field named quantity in the form
| > (same value for every one of your other records)
| > - since it is not unique the way you have it now, and ASP (or any other form processor) has no way of knowing which of the
other
| > dupes to even look at (they are just ignored)
| >



Re: Form validation opportunity/challenge by MikeR

MikeR
Sat Jun 04 08:05:08 CDT 2005

The index n is used to access the separate items in the array on the receiving side. NOT
on the creating side. Look at the response string, and note for example PID. It does *NOT*
have a number appended to it, thus giving 3 unique names. I think this demonstrates that
you CAN have dupe names in the form, and attach different values to them in the request,
and access them reliably on the receiving side.

I am looping thru the request string on the receiving side, so I suppose one could deem an
array index as creating a unique name if that's what you mean.

I think our disagreement is terminology. Can we agree to disagree?
MikeR

Stefan B Rusynko wrote:
> They work because in the sample code you are now showing you have an (n) as part of the query
> request.form("PID")(n), etc.
> and (n) is probably incremented in each row thru your code
> - so each form field name / object is unique
>
> In your original example (different field names) you only had non unique field names repeating in the rows as say <input
> type="text" name="quantity" size="20"> w/ no signs of the (n) incremented code
>

Re: Form validation opportunity/challenge by Stefan

Stefan
Sun Jun 05 03:55:10 CDT 2005

We can always agree to disagree (-;

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
_____________________________________________


"MikeR" <nf4l@pobox.com> wrote in message news:uN4MNYQaFHA.3556@TK2MSFTNGP09.phx.gbl...
| The index n is used to access the separate items in the array on the receiving side. NOT
| on the creating side. Look at the response string, and note for example PID. It does *NOT*
| have a number appended to it, thus giving 3 unique names. I think this demonstrates that
| you CAN have dupe names in the form, and attach different values to them in the request,
| and access them reliably on the receiving side.
|
| I am looping thru the request string on the receiving side, so I suppose one could deem an
| array index as creating a unique name if that's what you mean.
|
| I think our disagreement is terminology. Can we agree to disagree?
| MikeR
|
| Stefan B Rusynko wrote:
| > They work because in the sample code you are now showing you have an (n) as part of the query
| > request.form("PID")(n), etc.
| > and (n) is probably incremented in each row thru your code
| > - so each form field name / object is unique
| >
| > In your original example (different field names) you only had non unique field names repeating in the rows as say <input
| > type="text" name="quantity" size="20"> w/ no signs of the (n) incremented code
| >