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

Hi, Here is a futher intresting 1

Status
Not open for further replies.

Jimuniguy

Technical User
Mar 6, 2002
363
GB
Hi,

Here is a futher intresting one. We all use forms in our normal code to have a dropdown box or whatever.

However, I want to to be different, rather then drop down, i would like the user to "click" on the selection instead. This means it could be anything, not just a place, but could a town, city whatever, I just don't want to do it using the normal form code.

Does it involve needing to set a variable or something. The code below is an example of what I would like if only I could get the table bit to work (obviously it does not in this version, and its doesnt have to use the table code either. It does need the layer tag in though!

Cheers

Code:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<div id=&quot;Layer1&quot; style=&quot;position:absolute; left:10px; top:156px; width:785px; height:183px; z-index:1; background-color: #99FF66; layer-background-color: #99FF66; border: 1px none #000000;&quot;> 
  Please select one or more destinations that you would like brochures for: 
  <FORM ACTION=&quot;ResponseQueryString.asp&quot; METHOD=GET>
<Option NAME=&quot;HolidayLocation&quot;>
<table width=&quot;60%&quot; border=&quot;1&quot;>
  <tr>
    <td><OPTION>Madrid</OPTION></td>
    <td><OPTION>Rome</OPTION></td>
    <td><OPTION>Paris</OPTION></td>
    <td><OPTION>Berlin</OPTION></td>
    <td><OPTION>Moscow</OPTION></td>
    <td><OPTION>Birmingham</OPTION></td>
  </tr>
</table>  
</SELECT>
<INPUT TYPE=&quot;SUBMIT&quot;>
</p></FORM></div>
<H3>Holiday Form</H3>
<p>&nbsp;</p></BODY>
</HTML>

Any thoughts?

James
 
Don't quite understand what your getting at here... Do you mean you want the options in the dropdown menu to be dynamically created?

Could you explain a bit more ? Nick (Web Designer)


nick@retrographics.co.uk
 
Hi,

Ok, I will try my best:

Normally
A user normally selects something they want to see by using a radio button, or a drop down box on a form.

What I want
I want the user to &quot;click&quot; on the option, so that no radio buttons or drop down or select bits are used.

Think of it like having 5 playing cards on the screen, I want to the user to be able to click on one of thoose to select it, and then press the submit button and the value of that card to be sent

Does that make it any easier to understand?

Cheers

James
 
I see what u mean now.

You don't really need to use forms to accomplish this. You could just have the images or whatever in a table, with querystring links to the page that handles the selection, such as:

<a href=&quot;process_selection.asp?image=image1&quot;>
<img src=&quot;image1.gif&quot;>
</a>

<a href=&quot;process_selection.asp?image=image2&quot;>
<img src=&quot;image2.gif&quot;>
</a>

Does this help at all?
Nick (Web Designer)


nick@retrographics.co.uk
 
Hi,

Ooooo so close!

Rather then use images, can u tell me how its done in table with say 5 cities?

And just to add a twist to it, Say i need to select 3 different types in the same page then send it:

E.g.
5 Cities
5 Months
5 Airlines

Can it still be done?

Thanks!

James
 
Its gonna be a lot more complicated if you want to select multiple things, but it is possible.

It would probably mean creating a variable which holds information about which items are already selected. It would start off with nothing obviously.

Then, when the image is clicked, the page would be reloaded with the value of the clicked image in the querystring, which could then be appended to the variable. (might have to be a session variable to keep its value inbetween page loads).

This variable could then be used to create a hidden field within the form, holding the values of all the selected items, which would be sent when the form was submitted.

Bear in mind this may take a while to implement properly! Wouldn't it just be easier to have little pictures with a check box next to each one?

If you need any more help just ask.
Nick (Web Designer)


nick@retrographics.co.uk
 
Hi,

Thanks for your help Nick, you have given me lots of ideas/problems to go and think about now!

Cheers

James
 
Nick, or anyone else.

Just another thought.

If i do a form, which produces 3 variables into the URL. That I can do, but if i wanted to pass them onto every page, each time the user clicked a link WITHOUT using cookies or sessions, how can it be done???

Cheers

James
 
Announce this at the top of your code:


Dim variable1, variable2, variable3, variablestring

variable1 = Request.Form(&quot;variable1&quot;)
variable2 = Request.Form(&quot;variable2&quot;)
variable3 = Request.Form(&quot;variable3&quot;)

variablestring = &quot;?variable1=&quot; & variable1 & &quot;&variable2=&quot; & variable2 & &quot;&variable3=&quot; & variable3


Then your links would all have to have this variable after them e.g.

<a href=&quot;page.asp<% =variablestring >&quot;>Link to page</a>


Hope this helps! Nick (Web Designer)


nick@retrographics.co.uk
 
Hi,

Ah, i was just about to ask u that!

I take it the code in the page would be:
Code:
<%
Dim variable1, variable2, variable3, variablestring

variable1 = Request.Form(&quot;variable1&quot;)
variable2 = Request.Form(&quot;variable2&quot;)
variable3 = Request.Form(&quot;variable3&quot;)

variablestring = &quot;?variable1=&quot; & variable1 & &quot;&variable2=&quot; & variable2 & &quot;&variable3=&quot; & variable3
%>
and its placed in the head part?

and in the orignal form, the names in the form pushed through the URL are Variable1?

E.g. 

[code]
<FORM ACTION=&quot;ResponseQueryString.asp&quot; METHOD=GET>
    <SELECT SIZE=3 NAME=&quot;Colour&quot; MULTIPLE>
  <OPTION>Madrid</OPTION>
  <OPTION>Rome</OPTION>
  <OPTION>Paris</OPTION>
  <OPTION>Berlin</OPTION>
  <OPTION>Moscow</OPTION>
  <OPTION>Birmingham</OPTION>
</SELECT>
<INPUT TYPE=&quot;SUBMIT&quot;>
</FORM>

So then the code being called (if i take ur example above) would be:

variable1 = Request.Form(&quot;colour&quot;)

Thanks for helping me so much, I've only being doing ASP for 3 days now so sorry if these all seem like basic silly questions

Star award!

james
 
Hi,

Doh i mean:

variable1 = Request.QueryStrings(&quot;colour&quot;)


Cheers

James
 
Your form should be something similar to this:


<FORM ACTION=&quot;ResponseQueryString.asp&quot; METHOD=GET>
<SELECT SIZE=3 NAME=&quot;Colour&quot; MULTIPLE>
<OPTION value=&quot;madrid&quot;>Madrid</OPTION>
<OPTION value=&quot;rome&quot;>Rome</OPTION>
<OPTION value=&quot;paris&quot;>Paris</OPTION>
<OPTION value=&quot;berlin&quot;>Berlin</OPTION>
<OPTION value=&quot;moscow&quot;>Moscow</OPTION>
<OPTION value=&quot;birmingham&quot;>Birmingham</OPTION>
</SELECT>
<INPUT TYPE=&quot;SUBMIT&quot;>
</FORM>


Then your variable bit goes at the top of the body section, not the head section, and should be something like this:

colour=Request.QueryString(&quot;Colour&quot;)

Do you follow? Nick (Web Designer)


nick@retrographics.co.uk
 
Hi,

Er dunno, i think so. I will let u know soon enough!

Cheers

james
 
JamesUniqueGuy,

You could, when the person changes his/her selection, open a new window for each selection. Just a thought.


fengshui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top