HTML Select Tag

Discussion in 'iPad Development' started by rfresh, May 20, 2010.

  1. rfresh
    Offline

    rfresh iPF Noob

    Joined:
    May 20, 2010
    Messages:
    4
    Thanks Received:
    0
    Trophy Points:
    0
    Ratings:
    +0 / 0
    I'm writing a web app that runs on the iphone/iPad. I have a listbox with an onChange() javascript event. I notice listboxes on Safari on the iphone/ipad do not fire on the onChange() event. What event should I be using if not onChange? or is there a trick to detecting the onChange() event?

    Thanks
  2. mgamber
    Offline

    mgamber iPF Novice

    Joined:
    May 13, 2010
    Messages:
    22
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    SE PA
    Ratings:
    +0 / 0
    Sure it does!

    <html>
    <body>
    <select onChange="alert('test');">
    <option>Select an option</option>
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
    </select>
    </body>
    </html>

    That worked fine for me on iPad's Safari. Sure you're using the correct tags and there's not a javascript error in there somewhere?
  3. rfresh
    Offline

    rfresh iPF Noob

    Joined:
    May 20, 2010
    Messages:
    4
    Thanks Received:
    0
    Trophy Points:
    0
    Ratings:
    +0 / 0
    I think the difference is that my SELECT is a multiple selection listbox. When I select items in the list and then touch the Done button in the list, the list goes away but the JS function does not fire.

    PHP:
    <SELECT NAME="frm_employees_cbo[]" MULTIPLE='multiple' onChange="employee_list_click();">
  4. mgamber
    Offline

    mgamber iPF Novice

    Joined:
    May 13, 2010
    Messages:
    22
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    SE PA
    Ratings:
    +0 / 0
    Ah yes, I see it with the multiple tag. The cheap "solution" would be to replace the onChange event with onBlur which still works. The better solution would be to investigate the onTouch... events and determine how to detect when a list item is changed, the Done button is tapped or something else is tapped which closes the list.
  5. rfresh
    Offline

    rfresh iPF Noob

    Joined:
    May 20, 2010
    Messages:
    4
    Thanks Received:
    0
    Trophy Points:
    0
    Ratings:
    +0 / 0
    Thanks - the onBlur worked perfectly to detect when the Done button is pressed!!
  6. allisonc
    Offline

    allisonc iPF Noob

    Joined:
    Oct 4, 2010
    Messages:
    2
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    NY
    Ratings:
    +0 / 0
    Options Aren't Showing Up until I click the select element

    I have a multi select form element:

    Code:
    <select  id="something" name ="something" onchange="something();" multiple="multiple" >
    <option value="something">something</option>
    <option value="somethingelse">something else</option>
    </select>
    On the ipad, the options aren't showing until I click the select element. Before I do that it says "0 Items".

    Any idea why? How to fix this? (BTW it works normally on a computer browser (IE, FF, Safari, Chrome, just not on the ipad)

    Thanks.
  7. rfresh
    Offline

    rfresh iPF Noob

    Joined:
    May 20, 2010
    Messages:
    4
    Thanks Received:
    0
    Trophy Points:
    0
    Ratings:
    +0 / 0
    I don't there is a way to do that. Until you manually select (or programatically select via Javascript) items, it shows 0, which in the iPad case, means no selections. 0 doesn't mean there are no items in the list, it means no items have been selected.
  8. allisonc
    Offline

    allisonc iPF Noob

    Joined:
    Oct 4, 2010
    Messages:
    2
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    NY
    Ratings:
    +0 / 0
    Okay, that's fine, if that's the default behavior. I haven't been able to find a guide to any of this stuff, so I'm just trying to figure things out as I go. Thanks.
  9. amar_bbsr
    Offline

    amar_bbsr iPF Noob

    Joined:
    Feb 9, 2011
    Messages:
    2
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    Oslo
    Ratings:
    +0 / 0
    asp.net Listbox does not render in ipad

    The Asp.net list control renders like a dropdown control safari ipad. What is the solution for it?
  10. nirvanatgr
    Offline

    nirvanatgr iPF Noob

    Joined:
    Apr 22, 2011
    Messages:
    6
    Thanks Received:
    0
    Trophy Points:
    0
    Ratings:
    +0 / 0
    it not good, pls different solutions thanks
  11. udhayamoorthy
    Offline

    udhayamoorthy iPF Noob

    Joined:
    Mar 17, 2012
    Messages:
    1
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    India
    Ratings:
    +0 / 0
    Did you find any solution for this multi select form problem in ipad?. kindly share your ideas..
  12. kgu87
    Offline

    kgu87 iPF Noob

    Joined:
    Mar 20, 2012
    Messages:
    2
    Thanks Received:
    0
    Trophy Points:
    0
    Ratings:
    +0 / 0
    If you insist on using select tag, search google for
    jquery tochecklist plugin.

    Otherwise you can implement it via ul with images and CSS/js for a more native look and feel.
    Last edited: Mar 20, 2012
  13. udhaya
    Offline

    udhaya iPF Noob

    Joined:
    Apr 11, 2012
    Messages:
    1
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    india
    Ratings:
    +0 / 0
    Hi allisonc,

    Did you found any solutions for this 0 items problem??

Share This Page

Search tags for this page

angularjs html select not working in iphone

,
html

Separate names with a comma.

More...