SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Jun 2003
    Location
    Germany
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is that possible?

    Hi there,

    I would like to achive to things using Javascript.

    1. I have 2 dropdown lists where a user can choose models for a photo shooting. In a third dropdown list the user can select how many photo sets should be produced. If the user seletcs only one model there should be 1-4 shootings available, if he selects two models there should be only 1-3 shootings available.

    2. We also have couples which appear as "one" model. If a user selects a couple he should not be able to select another model from the second dropdown list. The other way around would be also a possibility. I start with one dropdown and if the user selects a "single" model the second dropdown should appear.

    Is that possible? If yes, could you give me an idea how to do this?

    Thanks fro your support,

    ASchweti

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    With all the shooting and lack of coffee, I'm somewhat slow this morning. However, I think you're asking if selection lists can be dynamically created. If so, the answer is YES! See the various scripts/tutorials at my site (GrassBlade)
    Once you get some code up, let me/us see it.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2003
    Location
    Germany
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Vinny,

    I've had a look at your site, but I am not sure if that will solve my problem.

    The dropdowns I use are always identical filled with a various amount of models which the user selects on a previous page.

    Now there are three types of models. Male, female or couples. If the user selects either a male or female in one of the dropdowns he should be able to select a second male or female. If he/she seletcs a couple no second pick should be possible.

    To bring it to the point, no matter what it should not be possible to choose more than two human beings

    If it's still not clear drop me a note.

    Thanks and best regards,

    Alex

  4. #4
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Alex,

    From what I can make out, the Cascading Selects scripts/tutorials should work with some changes.

    The first select can be a simple one -- 3 options:male/female/couples
    based on that selection create a 2nd selection list
    if the selection is a couple, no third select, go straight to shooting select
    if the selection is male, the 3rd select contains only females, then go to shooting select.
    if the selection is female, inverse of above
    Final select: create a global var that holds the type of model(s) selected, based on that create your shooting select.

    As I said before, put up some code
    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  5. #5
    SitePoint Zealot
    Join Date
    Jun 2003
    Location
    Germany
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Vincent,

    I have not forgotten about this post. We have to decide first internally how we handle this issue.

    I believe it's still not clear what I try to do and it is certainly worth posting some code. I will do so as soon as I now what exactly needs to be established.

    Thanks for your input so far and stay tuned

    Best regards,

    ASchweti

  6. #6
    SitePoint Zealot
    Join Date
    Jun 2003
    Location
    Germany
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Vincent,

    we have decided to let PHP take most of the action and most of the scipt works fine.

    Except one "little" issue.

    We display different boxes for single models (male & female) and couples. For couples we only display one dropdown list. We have the following code involved...
    Code:
    gvalue1[i] = p.elements['actor1_'+i].options[p.elements['actor1_'+i].selectedIndex].value;
    gvalue2[i] = p.elements['actor2_'+i].options[p.elements['actor2_'+i].selectedIndex].value;
    Unfortunately Javascript is "a little" disappointed that we do not have actor2_$i for all boxes.

    Is there a way like if doesn't exist do not try to get value?

    Hope you know what I mean.

    Thanks and regards,

    ASchweti

  7. #7
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Not sure, but...I'm presuming you are running the 2 lines regardless of the actual existence of the selection box.

    You could put the code within a conditional. Not having all pertinent code to look at, I can only generalize.

    if (p.elements['actor2_'+i])
    gvalue1[i] =.....

    if (p.elements.name == 'actor2_' + i)
    gvalue1[i] =.....

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


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
  •