SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Hybrid View

  1. #1
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Disply none but use the values as hidden values

    <div style="display:none ">
    <select name="Country" >
    <option value="UA">Ukraine</option>
    </select>
    </div>

    when ii use style="display:none " as shown above , is that means drop down is not visible on UI but values are their and i can pass them to next form.

    is it correct what am geting from this code.
    i can use value of Country in next page ?

    is this like a simple hidden variable ?

  2. #2
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any one its urgent for me ...please

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,185
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    display none

    That may work but I don't think it's really needed. A simple hidden input would do the same thing.

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also note that when you use display: none; it can foul up some screen readers (not that it would matter in this case). Mittineague also has the right idea. Just use a hidden input field instead.

  5. #5
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my case is little different , i cant use hidden field for this but i want to use drop down which is hidden.
    so the main catch if am hiding this it will still work like hidden variable...?

  6. #6
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,185
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    hidden drop-down

    If the drop-down is hidden, how can it be selected? And if it only has 1 option, why not just put that value in a hidden input?
    Please explain why you can't use a hidden input so I can understand what you're trying to do.
    Quote Originally Posted by simplecode
    work like hidden variable
    Either way, it would be a variable that's hidden. It's just that a hidden input is the easier, and customary way to do this, and should make for a lot simpler coding.

  7. #7
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <select name="Country" >
    <option selected value="US">United States</option>
    <option value="CA">Canada</option>
    <option value="UK">UK</option>
    </select>

    this is drop down and in background as per some conditions am selecting one vale of drop down

  8. #8
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,185
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    hidden value

    Even if there is more than 1 value, I think that whatever code is being used to determine the selects value would still be more complex than code that would assign a value to a hidden input.
    As I said, it should end up with the same net result doing it with a select with display: hidden as it would with an input type=hidden, it's just unnecessarily more "messy". And as Dan Schulz mentioned, it could cause problems for some users.

  9. #9
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think the difference between display:none and visibility:hidden is
    display:none hides the complete block and dont occupies space but visibility:hidden hides the block and oddupies the space as well.

  10. #10
    Are You There? KDesigns's Avatar
    Join Date
    Oct 2003
    Location
    Your Monitor
    Posts
    1,146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a particular reason you can't use hidden fields? If it's a privacy issue (or something like that) wouldn't a hidden drop-down pretty much equal a hidden field??

    Besides, I'm not sure the display:none will pass the value always which could make it not so reliable.... could be wrong though.
    ChooseDaily.com - Follow on Twitter
    Top Resources for Web Designers and Developers Every Day!

  11. #11
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,185
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    css

    Quote Originally Posted by simplecode
    i think the difference between display:none and visibility:hidden is display:none hides the complete block and dont occupies space but visibility:hidden hides the block and oddupies the space as well.
    Yes, that's the difference. But both display: hidden and input type=hiiden take up no view-port real-estate.

  12. #12
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes that true but as i told you in this case i need that drop down and its value but i dont want to show them, this main concern.
    yup you are right instead of that we can use hidden values but i cant do that and i want value of drop down to get pass from this page.
    i think the above code is not goin to creat any issue.....
    whts ur thoughts


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
  •