View Full Version : Is conditional display possible on a page?
I would like to show additional options in a form depending on what country is selected in the drop-down list. For example, Commonwealth countries are offered additional insurance, but this offer is not available to others so we don't want to show it unless Canada/Aus/NZ are selected. I created 2 versions of the page and it works, except that the date values are not preserved for the 2nd version of the page even though I tried using hidden values (may be doing it incorrectly). I'm able to carry the values from the second page to the 3rd but not from the 1st to the second. I can't seem to figure it out.
I'm wondering if it is possible to use one page with just a small section that drops down when Canada is selected, and how to do it. Or, if not, is there a way to carry the values to the second page?
You can see the problem at www.carrentalhawaii.com
Thanks for your help.
If you can do an instant ip to country conversion you can. But even that can be spoofed with a proxy server.
Medyman
05-11-2008, 07:24 PM
If you can do an instant ip to country conversion you can. But even that can be spoofed with a proxy server.
The question wasn't about how to do it automatically. I think they want it after use-input.
You can either this (http://www.dynamicdrive.com/dynamicindex16/chainedselects/index.htm) or this (http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm).
I get the feeling this is possible only with Ajax, ie. to change something on a page based on a value submitted after the page has loaded, without having to refresh the page.
Or can javascript do it? (John would know :))
Medyman
05-11-2008, 07:30 PM
I get the feeling this is possible only with Ajax, ie. to change something on a page based on a value submitted after the page has loaded, without having to refresh the page.
Or can javascript do it? (John would know :))
Looks like we posted at the same time. You certainly don't need Ajax for this. Javascript is plenty. That's what the DOM is for -- manipulating the page after it's loaded.
Thanks for the replies. Animated div... very cool! I realized after looking at it more that I was off track and asked the wrong question.
Here is the problem: People come to the page for a price quote. They enter their pick-up and drop-off locations and dates, their country of residence, then press the submit button.
IF their country of residence is Canada, they are taken to a Canadian version of the home page where they have to enter this info all over again, just so they can choose insurance. Is there a way to bring the values they entered on the main home page to this Canadian page, bearing in mind that both these pages are dynamically assembled from templates using includes for the various drop-down lists and data from a database?
These parts have a default value built into them. For example:
<option value="E" selected="selected">Full Size</option>
Is it possible to apply a variable value to an include?
My brain is addled from lack of sleep. There is probably a simple solution and I have made it sound so complicated. Any ideas? Thanks, erin :)
Medyman
05-12-2008, 01:52 AM
You can add the values to the URL and bring it with you to the next page. Do you need to confirm availability before you ask for country-specific information?
If not, this is what I would do in this situation. Include the country specific forms on the page but hidden via CSS. Then, if a user picks "Canada" from the country drop down, the page updates to show the Canada-specific parts.
A related example (http://visualbinary.net/files/tutorials/choose-your-destination/) to show how to trigger hidden elements through drop-downs.
Wow, that is a really great example. Need to run to a concert right now but will check it out later.
No need to confirm availability. How do you add the values to the URL?
Ciao for now, erin :)
Medyman
05-12-2008, 03:47 AM
Wow, that is a really great example. Need to run to a concert right now but will check it out later.
No need to confirm availability. How do you add the values to the URL?
Ciao for now, erin :)
If you don't need confirm the information before giving out the insurance form, then I suggest you go with my second suggestion above. It's all done with simple javascript.
When someone chooses a country that needs a particular form, that form would appear. You could have a separate for each country that needs one or a common form for all countries that require the extra form.
Adding the values to the URL would depend on your PHP script. I don't recommend this approach though, as you have a lot of data to pass on.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.