ginerjm Posted March 27, 2011 Share Posted March 27, 2011 ok - nobody seems to know much about js on the iphone - errors that is. So - in the meantime I've been experimenting and come up with this so far. function CopyResult() { var x=document.getElementById("curdirs").value; try { 1 var str = x; 2 var arstr = str.split(" "); 3 if (arstr.length >1) { 4 document.getElementById("mntstsy").checked = true; } 5 else { 6 document.getElementById("mntstsn").checked = true; } 7 str = arstr.shift(); 8 alert("shift done- now using: "+str); 9 document.getElementById("uid").value =str; 10 alert("set uid"); This function is called from an html "select" tag using the onchange event. I've tried several alerts in the function and find that I'm getting thru it up until I try to set the "uid" input tag in line 9 with the value in the var "str". The alert following this line doesn't get executed. I do know that I have values that are good as I've seen them using alerts, and I can see that the actions performed by lines 4 or 6 get performed. But then it dies giving me an error message of "undefined". Does anyone have a clue why line 9 fails on safari (iphone) and runs just fine on IE? Quote Link to comment https://forums.phpfreaks.com/topic/231897-followup-to-my-error-on-iphone-using-js/ Share on other sites More sharing options...
ginerjm Posted March 27, 2011 Author Share Posted March 27, 2011 Found it. The field I was trying to set I hadn't put an ID attribute on. The only one missing it! Quote Link to comment https://forums.phpfreaks.com/topic/231897-followup-to-my-error-on-iphone-using-js/#findComment-1193044 Share on other sites More sharing options...
Adam Posted March 28, 2011 Share Posted March 28, 2011 But then it dies giving me an error message of "undefined". Take a look at my response to one of your other posts. If you were using the same error handling here as you were there, you would have gotten a better error message and solved this instantly. Quote Link to comment https://forums.phpfreaks.com/topic/231897-followup-to-my-error-on-iphone-using-js/#findComment-1193228 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.