DragonRAD Forum
June 18, 2013, 08:34:29 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Image Error - returns nil  (Read 644 times)
jareds
Member
*
Posts: 14


View Profile
« on: May 31, 2012, 06:21:42 AM »

Hi Guys

Having a problem with my code - it is supposed to check if a picture has been captured when the save button is hit. The script for the picture check is as follows:

function ValidateIfPictureExists()

 local lFields = clientevent.form.fields
 local lPicture =lFields["qmob_assets.asset_picture"].value
 
 client.alert(lPicture)
 
 --check if the picture exixts, if not, warn user and exit save
 if (lPicture == "" or lPicture == nil) then
  client.alert("Please Capture a Picture")
 end
 
end


although a picture is captured, the error message still displays that a nil is returned, but the picture blob is still saved in the table.

any ideas?

thanks
Logged
Rob Nicol
Seregon
****
Posts: 82


View Profile
« Reply #1 on: June 01, 2012, 07:29:51 AM »

Hi Jared,

Depending on the version of DragonRAD, there are different solutions.

I believe you are still using 4.3 so it is likely best to try the imageValue property on the field to get the image bytes.  We have simplified this in newer versions of DragonRAD so that the value property returns the image data if the field is an image.

Another option is to set a global flag when the form is opened (i.e. globalImageChanged = false)
Then add a data change script to the image field which change: (i.e. globalImageChanged = true)
In the save button, you can check the flag to see if the imagefield changed, meaning an image has been captured.

Rob
Logged
karthik.rudra
Member
*
Posts: 17


View Profile
« Reply #2 on: June 08, 2012, 12:51:52 AM »

Hi guys...

I have an issue regarding image searching..!!
here i wanna search from my app for a pic from several pics stored in phone memory and add them to database table..!!

do we have any built-in action to do or need to go with lua script ???
 
Logged
Rob Nicol
Seregon
****
Posts: 82


View Profile
« Reply #3 on: June 08, 2012, 04:47:38 AM »

An action can be added to pick from a file:
1) From a menu, button, or the like, add a new action
2) Set the label for the action, and then select "Menu Actions"
3) In the "Menu Actions" dialog, set the "Field to Change" to an image field found on the form
4) In the "Actions" section, scroll down to "FieldMenuAction" and set it to "Image_FromFile"

A file picker will open up on the device when the menu action is selected. From there you can select an image, and the image field will be updated with the chosen image.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!