Results 1 to 9 of 9

Thread: Is conditional display possible on a page?

  1. #1
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default 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.

  2. #2
    Join Date
    Mar 2008
    Posts
    218
    Thanks
    7
    Thanked 19 Times in 19 Posts

    Default

    If you can do an instant ip to country conversion you can. But even that can be spoofed with a proxy server.

  3. The Following User Says Thank You to tfit For This Useful Post:

    kuau (05-11-2008)

  4. #3
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by tfit View Post
    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 or this.

  5. The Following User Says Thank You to Medyman For This Useful Post:

    kuau (05-11-2008)

  6. #4
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    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 )

  7. #5
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by kuau View Post
    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.

  8. The Following User Says Thank You to Medyman For This Useful Post:

    kuau (05-11-2008)

  9. #6
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    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:

    Code:
    <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

  10. #7
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    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 to show how to trigger hidden elements through drop-downs.

  11. The Following User Says Thank You to Medyman For This Useful Post:

    kuau (05-12-2008)

  12. #8
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    642
    Thanks
    284
    Thanked 15 Times in 15 Posts

    Default

    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

  13. #9
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by kuau View Post
    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •