Database insert by clicking image

Team,

Is there a way in Wappler to insert a particular database value by clicking a particular image?

Example:
Image of Category 1 + Image of Category 2

If user clicks Image of Category 1, a server action is triggered to indert “Category 1” in the assigned database column.

I could potentially think of:

  • A formatted radio button (i.e. Radio button replaced by an image)
  • A server action dedicated to insert the value “Category 1” in the database, with that action being triggered by clicking the image of Category 1?

Hope this question is making sense..

I do this when creating audit trails

Create a server action based on $_GET parameters

Create a database connection in app connect and click “no auto load”
image

The in the click action of the button load the server action with the appropriate parameters i.e.

This will run the server action on click of the button

The down side is you can’;t capture the server connect events results when running a server action in this way, not a huge issue when and audit function, the odd missed audit entry would not be the end of the world (then again i don’t think i have yet seen a server action fail)

Alternatively, if appropriate, just put the button inside a fom tags and use a post action which will allow access to server connect result actions (make the button the submit button, parameters as hidden fields).

I find this method can cause layout issues on complex pages which is why i prefer $_GET method for non mission critical functions

2 Likes