I might have found the culprit, but it's going to require extensive debugging.
I seem to recall that JavaScript gets terminated/disabled if its not
executed within X amount of seconds in mobile safari. I'm not sure if
this behavior is similar with setTimeout(). In either case, I changed
the following in bold and it seems to be submitting the form with
JavaScript again. I hope this isn't the real answer to the problem,
because it certainly just doesn't feel proper.
<code>
setTimeout(function() {
$('edit_patient_form').addEvent('submit', function(e) {
new Event(e).stop();
if (!validateForm('edit_patient_form')) return;
var oldHtml = $('log_res2').innerHTML;
var log =
$('log_res2').empty().addClass('ajax-loading');
$('log_res2').innerHTML =
"<br><br><br><br>Updating patient...
please wait!";
this.send({
evalResponse: true,
onSuccess: function() {
setTimeout(function() {
/* remove existing
patient list first */
$('patient_view_list').empty();
/* we need to retrieve
the new patient list
and inject it into
the view */
new
Ajax('ajax/select_active_patients', {
method: 'post',
update:
'patient_view_list'
}).request();
log.removeClass('ajax-loading');
log.innerHTML = oldHtml;
slidePanel('edit_patient_view', 'patient_list_view', 'down');
/* }, 3000); */ /*
potential culprit */
}, 1000); /* new value */
},
onFailure: function() {
$('added').empty();
}
});
});
}, 500);
</code>
Thanks again for anyone following this thread. If you find similar odd
issues, please feel free to share. :-)
- sf
On 11/15/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've noticed a weird bug that required me picking up a separate iPhone
> to replicate. I couldn't replicate it on mine. Someone was complaining
> that on http://iphone.limemedical.com, when you edit a patient, and
> try to use the 'Update' button, it would randomly spit out a DB error.
> This is the same error that would happen if the form was submitted via
> a non-javascript regular POST submit.
>
> I can't replicate the issue on my iphone. I can on my fiance's....
>
> Has anyone else seen JavaScript shutdown in such a fashion? Feel free
> to give it a try yourself if you're in the mood to help me
> troubleshoot this. Just click on any patient row on the landing page.
> It's there for demonstration purposes... Change any fields in the
> edit patient form and hit update. If you do it a couple of times 1 out
> of 3 times it's as if javascript gets disabled.
>
> At first I thought it was a limitation at the iPhone's in the apple
> store as a co-worker was testing this in an Apple store and brought it
> to my attention. I'm able to replicate it on my fiance's phone though.
> :-(
>
> Thanks for any insight folks,
>
> - sf
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---