Link to home
Start Free TrialLog in
Avatar of Richard Korts
Richard KortsFlag for United States of America

asked on

Different Javascript on iPhone than Win 10 desktop?

I have this code in a program specifically designed (from a user interface perspective) to run on phone size devices.
if (document.st.pn.value == "" || document.st.padr.value == "" || document.st.cityf.value == "" || document.st.zip.value == "") {
					alert("Minimum of property name, address, city & zip required.");
					return false;
			}	

Open in new window


When the specific form fields as indicated are filled in on the form on my iPhone (an iPhone 6), the test displays the alert, thus preventing submission of the form.

When I run the EXACT same program on a Windows 10 desktop, filling in the required fields, it works.

Does Javascript somehow differ on the iPhone from the desktop. Is it a Safari browser issue?

Thanks
Avatar of HainKurt
HainKurt
Flag of Canada image

I dont see any issue here...

it should work...

do you have any test link?
Avatar of Nicholas
Nicholas

Is one of the fields a dropdown?

Different browsers have different engines, but they all work pretty much the same
where do you call this function?

maybe you should just start using jQuery
ASKER CERTIFIED SOLUTION
Avatar of James Bilous
James Bilous
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or use

document.st.pn.value

>>>

document.forms["MyForm"].pn.value

or

document.forms[0].pn.value

if it is first or only form on page...
Avatar of Richard Korts

ASKER

I will try your suggestions. The test link is not practical, a login is required, I would have to set one up for EE, communicate privately, etc.

I think document.forms[0].pn.value is the easiest to try.

The function this code is in a function called chk_vals & is invoked by the onSubmit event. I can show all the code but it's mixed in with php, etc.

Thanks
I did not try the other stuff. getElementById worked.