PDA

View Full Version : Active Phone number on smart phone?


ABC123

kingcarol
06-19-2013, 08:22 AM
I am not deploying my experiments in V12 yet (for a good reason), so I just wanted to ask whether smart phones can detect that a field in a grid component that is an embedded component in a panel has a phone number in it.. so that when user clicks it on a smart phone, it does the 'call' thing. Is there something I should be setting in the phone number field on my grid to make this happen?

UPDATE: To save someone from reading through the trial and errors in this thread, the answer to my question was to put the following javascript code in the OnClick event of the phone number field on my embedded read-only grid:


\\In this case, MOBILE is the name of the field that holds the phone number.
var pno = {grid.object}.getValue('G','MOBILE',{grid.rowNumber});

if (A5.flags.supportsTouch !=false) {
window.location = 'tel:'+pno;
} else {
alert('Not running on a mobile phone device.');
}

Lance Gurd
06-19-2013, 10:39 AM
Hi Carol,

I would think you want some sort of button that does the 'call' thing, otherwise any clicking in the field to edit/add would start calling the number. Not sure how you would access the 'call' thing though. It's probably different between Android, blackberry, iphone and windows phone.

Bill Griffin
06-19-2013, 10:51 AM
On IOS devices (and I think android as well) you do not have to do anything other than display a phone number. Every site(whether its a mobile site or not) If I touch a phone number I am given the opportunity to call or not (cancel)

Lance Gurd
06-19-2013, 11:21 AM
Hi Bill,

That works if the number is part of the web page, but if it is a field in a form on a web page it does not. You just get to edit the number that is in the field.

Bill Griffin
06-19-2013, 12:42 PM
You are correct sir....

kingcarol
06-19-2013, 01:38 PM
So it sounds like I should take the grid I have in the panel and make an a5w page from the grid and put that in the panel. It's a non-updateable grid anyway, so I'll try that.

Bill Griffin
06-19-2013, 02:01 PM
Not sure if that will work( even though theoretically it should), but its worth a shot.

kingcarol
06-20-2013, 08:58 AM
Just tried putting the grid in a page, and encountered various sizing, filtering, etc. obstacles with it in a panel. ANYWAY, would rather find out use a 'Call' button on the panel header where grid is embedded (as Lance mentioned). Any more ideas out there?

Hmmm, I'm thinking that I might need to set a session variable in Xbasic that contains the phone number and send it into a page that is then opened in an IFrame panel.

Bill Griffin
06-20-2013, 11:02 AM
This shouldn't be that difficult to do, yet.... I tried a couple of things, but to no avail. I am in contact with Bob Moore. I will let you know what I find out.

kingcarol
06-20-2013, 12:15 PM
I've tried a bit, too. Having trouble getting the page I made to update the data in the session variable I'm using to send in the phone number. When 'Call' button clicked on panel, I call an Xbasic function that does an sql query to get the phone number where the contact id is supplied from a Contacts list object. It returns the phone number in the result set. Then the function sets a session variable to that phone number. Then the function sets focus to the panel with the page in it. The page has this on it: <%A5 ? session.ContactHomePhone %> The page displays a phone number, but it keeps remembering a previous value. I check marked that the page embedded in a panel should 'Refresh When Panel Card Gets Focus' but that's not helping. If I go back to Design Mode and then to Live Preview again, THEN I see the phone number value for the last contact selected in the contact list from LAST live preview.

I have verified that the session variable does get set to the proper value in the xbasic function by having the function pop up a message that shows the value. But somehow that doesn't get updated when setting focus to the panel with the page embedded in it.

kingcarol
06-20-2013, 01:00 PM
So... for your thrilling entertainment of the day, I did a little video to show where I was at so far and trouble I'm having with session variables: http://screencast.com/t/oLwBMy9kp

kingcarol
06-21-2013, 06:17 AM
Update: It appears that my session variable issue has been resolved by check marking 'Delay Render Until Visible' in the properties for my embedded a5w page of phone numbers.

Bill Griffin
06-21-2013, 08:01 AM
Check out this video from Bob More: http://youtu.be/E8i899iDyKc

I think after you watch this you will be able to simplify what you are doing..

Lance Gurd
06-21-2013, 09:34 AM
That's really cool! And it taught me things as well.

kingcarol
06-21-2013, 10:32 AM
Just watched Bob's video. Yes, Cool! Dumb question... when he shows the javascript in the List Events, is this line:
window.location = 'tel:'+this.value;
telling a touch device that this is a phone number? ie, is the prefix 'tel:' triggering the touch device to pop up the little Call window?

Bill Griffin
06-21-2013, 10:35 AM
Yes

kingcarol
06-21-2013, 11:14 AM
So, I'm thinking that if I put this javascript in the OnClick property of a phone number field in a grid that is embedded in a panel, then simply clicking the phone number will cause a mobile phone device to pop up that Call window. I have put the code there, but am unable to test on a mobile device because I'm not ready to install V12 on my server, AND I can't figure out how to get the 'Remote Test' thing to work.. (too ignorant of that stuff, I think).


if (A5.flags.supportsTouch !=false) {
window.location = 'tel:'+this.value;
} else {
alert('Not running on a mobile phone device.');
}

Bill Griffin
06-21-2013, 11:35 AM
I don't think that will work unless you have set this.value somewhere. It should be referencing the value on your grid, or better yet your UX component. The this.value comes from the list component.

DO you have a smart phone that is on the same network as your a5 developer? you need a QR scanner (I use something called Scan) on my iphone) and jusr scan the QR code and your browser will open the page

kingcarol
06-21-2013, 11:43 AM
Hi, Bill. Yep, I figured I would have to get the value in the field and not use this.value... I know how to do that. BUT, regarding the Remote Test, I can't even get as far as you are suggesting because it errors right away and cannot write to a file of some kind. Short video: http://screencast.com/t/xDv6H3nTsSZ

Lance Gurd
06-21-2013, 11:43 AM
Just tried it Carol and it works! I copied your code and put it in the onclick event for the phone field in a read only grid.

I would, however, use a list control instead of a grid now you are moving to V12. They are so much more flexible and the appearances you can create are great.

Ignore the above, spoke too soon. Like Bill says the this value does not return the correct phone number.

Will try something else shortly

kingcarol
06-21-2013, 11:50 AM
That's good to know, Lance. I'm using an embedded grid because I need to display address, email, type of contact, and several phone numbers for my contacts in one spot. I ended up deciding I did not want to make a bunch of list controls to return the different phone number values..but maybe I'll learn more and decide to use list controls later. I just started out trying V12 so have a lot to learn.

Now if I can just figure out how to do a Remote Test...

Lance Gurd
06-21-2013, 11:51 AM
Okay,

changed the code to



var pno = {grid.object}.getValue('G','MOBILE',{grid.rowNumber});



if (A5.flags.supportsTouch !=false) {
window.location = 'tel:'+pno;
} else {
alert('Not running on a mobile phone device.');
}
Where MOBILE is the phone number field and all works fine

kingcarol
06-21-2013, 12:00 PM
This forum is so great! We managed to get to the simple answer to my first question in this thread! YAYYY.

Lance Gurd
06-21-2013, 12:03 PM
For some reason I cannot upload a picture anymore! So this maybe harder to explain. Go to the remote test button and fast preview. Then when the dialog is open select QR code as the output. Then under Host name settings select IP Address, an input box pops up, then press the show IP address of my machine link, another dialog pops up showing a numeric IP address, copy that into the input box next to IP Address then select Ok. You should get the QR code ready to scan with your phone

Bill Griffin
06-21-2013, 12:05 PM
Are you running Windows 8? I get the same error on my windows 8 box but my win 7 is fine. I sent a bug report in.

Bill

kingcarol
06-21-2013, 01:43 PM
Are you asking me, Bill? I have windows 7.

Bill Griffin
06-21-2013, 01:53 PM
Sorry Carol, yes I was asking you.

kingcarol
06-21-2013, 03:01 PM
Bill, I was able to get the Remote Test thing to start working. I studied the path in the error message that it said it could not write file to and then followed that path in Windows Explorer and found that there was NOT a RemoteTest folder in the last folder in the path. So I created the folder. Then it started working.

C:\Users\Owner1\AppData\Roaming\Alpha Software\Alpha Anywhere Version 12\Installations\CProgramFilesx86a5V12\RemoteTest\

Bill Griffin
06-21-2013, 03:19 PM
Cool , I was able to get rid of that message and have another, but it is only on my win 8 system. Were you able to get your phone test done?

kingcarol
06-21-2013, 03:42 PM
Yes, Bill! The solution was to put the last javascript code Lance posted above in the OnClick property for the phone field in the read-only grid that I have embedded in a panel. It works beautifully. Bill, Thank you so much for posting Bob Moore's video (and tell him thanks)! It definitely pointed Lance and I in the right direction.

Bill Griffin
06-21-2013, 04:02 PM
Great!! This is good stuff. I know it is easier to stuff old grids into UX components, but it is probably better to just use the UX component with the controsl available for it. (yep more work!) I will pass your gratitude on to Bob.. Have a great weekend.