Hi,
Has anyone attempted having an interactive image in K2? For example, upon which area of the image which is clicked determines what action is performed?
Detail below:
Background
Imagine you have created a SmartForm, and on that SmartForm you have a Picture control and a Drop Down List.
- The Picture control display an image of a map of the office (for example).
- The Drop Down List contains the list of areas that are visible on the map (for example: Garage, Office 1, Office 2, etc.)
Functionality
When the SmartForm is used in runtime, the User can click on the image to pinpoint where an incident has occurred.
- Clicking on the image automatically sets the drop down list
- For example: If the User clicks on the image where Office 1 is, the drop down list is automatically set to Office 1
Implementation
I have managed to partly achieve this by using JavaScript.
- I used an online tool to create the co-ordinates for the image
- I then (in script) created an ImageMap (manipulating the DOM within the HTML) and then used the co-ordinates in a JavaScript function to set a control on the SmartForm
Issue
- If the image or browser is resized, the click area is not accurate and gets skewed (for example, clicking on one area highlights a different one).
- Also, this does not work when accessing the Form on a mobile (not a big deal, kinda expected)
Thoughts
There is a WOW factor in being able to interact with an image to capture location based data. However from a development perspective there appears to be here is too much scripting and issues involved.
Has anyone come across a request like this? I'd be intrigued to hear if you implemented anything like this before in K2 Five?
Workaround
As the app being developed is currently at version 1, the current workaround is to present the image and the user simply selects the location from the drop down.
Thanks!