User-1692070805 posted
I have used Javascript in mobile forms on the Blackberry, but I don't think I have had it post back anything to the server if that is what you need.
For example, I have an application that puts out 5 radio buttons and based on which one is clicked, it populates a TextBox field. It does that entirely within Javascript and does not post anything back to the server, so I'm not sure if that's equivalent to what you want to do.
But I did it like this:
In the form:
<mobile:DeviceSpecific id="devHistory" runat="server">
<Choice>
<FooterTemplate>
<asp:Literal runat="server" id="lblHistoryData"></asp:Literal>
</FooterTemplate>
</Choice>
</mobile:DeviceSpecific>
In the code behind in the Form's Activate event:
StringBuilder histList = new StringBuilder();
histList.Append("<input type=radio name=\"history\" value=\"value1\" onclick=\"document.QueryForm.txtCompany.value='value1'\">Value 1</input><br/>");
histList.Append("<input type=radio name=\"history\" value=\"value2\" onclick=\"document.QueryForm.txtCompany.value='value2'\">Value 2</input><br/>");
...
System.Web.UI.WebControls.Literal lblTemplateHistoryData = (System.Web.UI.WebControls.Literal)this.QueryForm.Footer.FindControl("lblHistoryData");
lblTemplateHistoryData.Text = histList.ToString();
What this does is finds the asp:Literal control (embedded in the form footer in my case) and replaces it with Javascript dynamically built in a string.
It sets up an onclick Javascript event for each radio button, which uses DOM to populate another field on the form. You could probably use a similar technique that would create some other clickable control that would call the GPS function and put the value returned into a server TextBox, which would then get sent back to the server when the form was submitted.
That may be less than ideal - if you wanted it to do that and then automatically submit the form, you would have to see if the Blackberry allows you to programatically submit the form with Javascript.
Or you could see if you could call .click() on the submit button on the form.
(I seemed to find that every time I wanted to do something in Javascript, there was something the Blackberry didn't support.)