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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2-part question about checkbox repeated regions 1

Status
Not open for further replies.
Apr 6, 2001
41
US
A TWO-PART QUESTION...

PART 1: I have a page with repeat region checkboxes on it that are populated by a database field like so...


Here's the problem: Notice how there are excess identical "industries" listed? The region is repeating according to how many like records there are in each industry. I don't want this. How do I solve this problem? If there is an industry, say "Roofing Contractor," how do I get the page to only list ONE checkbox for ONE industry instead of THREE checkboxes just because there are three "like-industried" contractors in the database? I hope this question makes sense. In a nutshell: I want one checkbox per industry even though there are multiple records within that industry.

PART 2: Try out the form by selecting only one checkbox and click on "Submit." It works, right? OK go back and try again, but this time select multiple industries and click "Submit." You'll see that the ?industry= values get passed but my verify.asp page won't display multiple industries in the same table. How do I remedy this?

Anyone's quick reply is very much appreciated! Deadline looms.
 
1)

Solution 1: Try to modify the SQL statement with a "select distinct" instead of the "select" and only the fields you use.

Solution 2: Dig in the source code (in the repeated region), create a variable that holds the previous value, then check if the current value is the same as the previous and display only if it is not.

If you don't want to dig, just mail me the relevant part (should be about 20 lines or so, isn't it?) to haslo@haslo.ch. Be sure to mention your problem - I also already got mails where I had to search for the thread first to be able to answer...

2)

There can be only one URL parameter per name. I think you have an ID in your database table for the industries? If not, you should create one. You can then name and pass the parameters as follows (assuming the ID exists and is named "id_industry"):

<input type=&quot;checkbox&quot; value=&quot;Attorney&quot; name=&quot;industry<%=(industries.Fields.Item(&quot;id_industry&quot;).Value)%>&quot;>

You can also paste the following into the &quot;name&quot; field in the property inspector:

industry<%=(industries.Fields.Item(&quot;id_industry&quot;).Value)%>

You can then create a loop in the result page that iterates through all those possible url parameters (like &quot;industry1&quot;, &quot;industry2&quot;, ...). Try to do this yourself and if you don't get there just post again, I'll write some cut-n-paste code.

A little complicated - but altough I like the ease of use of Dreamweaver pretty much, if it gets to more complex solutions the program seems not to be the perfect match anymore - you're just way faster writing the page yourself...
Don't blame macromedia for this - how should they be able to cover everything... ;-)
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
Your solution to Part 1 worked like a charm! Thank youso much!

I sent you an email about Part 2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top