Page 1 of 1

Phone Gap App with dynamic file name

Posted: Fri Nov 16, 2012 2:52 pm
by jac53
After being successful with the PhoneGap example (hard coded name) I would like to do the following:
Create a grid program with a hidden field containing a unique name which I am building inside my RPG to be used as the picture name.
In the App.js there is comment stating that get() API should be use for dynamic names.
I was thinking to execute the get(hidden field) like Takepicture(get(hifield));
Modify the Takepicture() to receive my hidden field as a parameter and override the picture.jpg with my new dynamic name in order to display back the picture.
Is this make sense?
What is the best way to accomplish this?

Thanks in advance for your help.

Re: Phone Gap App with dynamic file name

Posted: Fri Nov 16, 2012 5:14 pm
by Scott Klement
In this example, I have a hidden output box on the screen with an 'id' (not bound field name -- it needs to be the 'id') of "shpID". I wanted my upload to be named "shipmentXXXXX.jpg" where XXXXX = the shipment id.

So, I coded it like this:

Code: Select all

function takePicture() {

   var pictureName = "shipment" + get("shpID") + ".jpg";  

   pui.capturePhoto({ 
           dir: "/www/profoundui/htdocs/profoundui/userdata/images/shiplist", 
      fileName: pictureName,    
     overwrite: true, 
       handler: function(response) { 
          if (response.success) pui.click();  
          else alert(response.error);  
       }  
   });

}
Will something like this work for you?

Re: Phone Gap App with dynamic file name

Posted: Tue Nov 20, 2012 5:10 pm
by jac53
Hi Scott:

Thanks for your example. I put it to work my app. I am having problem redisplaying the picture.
I tried different things in the image source but without success. Any help will be appreciated.

Thanks,

Re: Phone Gap App with dynamic file name

Posted: Tue Nov 20, 2012 6:10 pm
by jac53
Hi Scott:
Discard my question.
Finally I put it to work. I bound a field to the image source and build the url in my RPG.

Thanks for all your help.

Re: Phone Gap App with dynamic file name

Posted: Wed Jan 09, 2013 2:30 am
by aashton
Dynamic Page Loading
The main HTML page for our application contains a div element to display dynamic content. It also loads the JavaScript code used by our application. Referring to the HTML code below, the container div is where we will place our content.
<body id="body" onload="init();">
<h3 id="header">PhoneGap Dynamic Pages Demo</h3>
<div id='container'></div>
</body>

____________
Mobile Dialers