Page 1 of 1
					
				auto dialing
				Posted: Tue Aug 11, 2015 3:06 pm
				by dbowman
				I am creating an app that contains a subfile that has a phone number as one of the elements.  I want to use the 'onclick' function to initiate a call when a number is selected.  I'm pretty new to this and could use some insight.  this is what I tried:
  window.location("tel:" + DPPHONE.row);
where DPPHONE is the element ID of the number to be called.  iPhone errors with "Onclick Error: Can't find variable: DPPHONE"
			 
			
					
				Re: auto dialing
				Posted: Wed Aug 12, 2015 1:40 pm
				by Glenn
				Dean,
I believe an easier way to do what you want is to make the phone number field a hyperlink widget and bind the 'value' and 'hyperlink reference' to DPPHONE. The iPhone should automatically recognize that the link is referencing a phone number and open the dialer. Let me know if that works for you.
Glenn
			 
			
					
				Re: auto dialing
				Posted: Wed Aug 12, 2015 2:06 pm
				by Glenn
				Dean,
Sorry, I misspoke. What I suggested will probably only work in a mobile app (that's what I get for posting before testing...). If you are doing this in a mobile web page then your code is almost correct. 
The code you have in the 'onclick' event should look like this:
Code: Select all
window.open("tel:" + get("DPPHONE." + row));
Keep in mind that we want the value contained in DPPHONE not the object named DPPHONE. The get() API that we provide will return the value. It's a shortcut for the JavaScript notation of getElementById().value.
Sorry for the confusion.
Glenn
 
			 
			
					
				Re: auto dialing
				Posted: Wed Aug 12, 2015 3:42 pm
				by dbowman
				Thanks Glen; I figured out the hyperlink last night; will keep both solutions for future development.