Page 1 of 1

Adding an Media to Mobile Form

PostPosted: Thu Mar 06, 2014 6:02 pm
by ars
Hi,

I am wondering how to add an media image over a Mobile form. Anyone has any idea on the same, please share.

Thanks!!

Re: Adding an Media to Mobile Form

PostPosted: Tue Mar 11, 2014 5:57 pm
by mattfrizzell
I'm not sure what you mean by adding an image "over a mobile form", but I can answer a way I got an image on a mobile form. I hope it isn't the right way to do it, but I can vouch for it being A way. In this example I wanted to brand a custom login screen.

#1. To start, I added a bean onto my form.
MobileBeanUse.PNG
MobileBeanUse.PNG (6.1 KiB) Viewed 1066 times


#2. In the "innerHTML" property of the bean I named and ID'ed an empty div.
Code: Select all
<div id="mylogo"></div>


#3. I added a jpeg of the logo to the Servoy media
Media.PNG
Media.PNG (11.82 KiB) Viewed 1066 times


#4. On the onLoad event of the form I used some jquery to add an image element to the empty div.
Code: Select all
$("#mylogo").html('<img id=adSailsLogo src="../[b]your_mobile_solution_name[/b]/media/adSailsMaster.jpg"></img>')


And the result was this login screen.
LoginScreen.PNG
LoginScreen.PNG (31.18 KiB) Viewed 1066 times


As I said, I'm not sure it is the "right way" to do things and certainly it could be easier, but in the end I was able to produce pretty much what I was aiming for. Accessing the Servoy media was not as I expected it to be so I struggled there the most. Hopefully this helps.