iTouch/iPhone - Hair-tearing problem...

Discussion in 'iOS Programming' started by freddal, Oct 6, 2008.

  1. freddal macrumors newbie

    Joined:
    Oct 6, 2008
    #1
    Hi all,

    We have developed a web site that includes a order-entry form (called the "detail" form) for data entry. Part of the form requires the user to select a product and to do that, we link out to another web page triggered by the "detail" form using javascript "window.open". The "detail" form remains on the iPhone/iTouch and Safari opens another window.

    At that other web page (we call the "list" form"), the user selects some criteria and performs a lookup that fetches data from a database. The lookup then displays about 20 records on the "list" form and the user is required to select one of them by clicking an icon adjacent to the item.

    That action results in javascript writing back into window.opener (on the "detail" form) and closes the "list" form.

    The problem: sometimes the data being written back into window.opener does so perfectly and the "detail" form redisplays.

    However, in the vast majority of cases, the "detail" form refreshes itself resulting in all the data that was entered by the user vanishing. The user has to start again...

    Has anyone experienced problems like this? Do you have a solution to this problem or do you have any suggestions that would help us get by this problem?

    Please note we absolutely must open the "list"window. There is no option to do this function inside the "detail" form.

    TIA,
    FredD
     
  2. robotspacer macrumors member

    Joined:
    Jun 25, 2007
    #2
    I've had this happen too. My guess at what's happening is the phone is running out of memory so it's dumping the opener from RAM—and then it can't call it anymore.

    You may be able to lessen the problem by making the popup form as minimal as possible. Little to no graphics, very clean HTML, etc.

    The ideal way to solve it though would be to use XMLHttpRequest to bring up the detail form on top of the same page—rather than opening a new window. If you're new to XMLHttpRequest I highly recommend using a framework like mootools ( See http://demos.mootools.net/Request and http://mootools.net/docs/Request/Request )... it greatly simplifies the process (and many other JavaScript tasks).
     
  3. freddal thread starter macrumors newbie

    Joined:
    Oct 6, 2008
    #3
    Thanks for the tip.

    Unfortunately, the pop up needs to pass information back to the calling form.

    I'm not clear from your suggestion how that would happen. Can you expand a bit on that for me?

    TIA
    FredD
     
  4. tyr2 macrumors 6502a

    tyr2

    Joined:
    May 6, 2006
    Location:
    Leeds, UK
    #4
    Assuming both pages are being served from the same domain you could consider encoding the users selection into a cookie and then reloading the original page which would then receive the cookie.

    Since you're developing for iPhone, if you don't mind restricting yourself to iPhone OS 2.0 or above, you could consider using a SQLite database to hold the users data. I wrote briefly about this on my blog, as you can see it's fairly simple (if you know SQL). This would give you the flexibility to access the users data wherever you need to.
     

Share This Page