Allow parsing dynamic content retrieved from a server action before rendering it


First of all, thank you for a great product!

I’m using Wappler 3.3.5 and using the appropriate bindings, I can store html-formatted text in a database table, retrieve it via a server action, and display it in a page.

That text, however, must be static. Any dynamic bindings stored in the database table will be rendered as a string, that is, without parsing it.

This feature request is to add a native option to Wappler, which I’ll call it “Inner Parsed” for now. This “Inner Parsed” option could be shown together with the “Inner HTML” and “Inner Text” options that appear under Dynamic Attributes > Display.

Any text bound to the proposed “inner parsed” option (e.g., a string returned by the execution of a server action) will be parsed for dynamic content before rendering it.

To clarify further the current behaviour , assume a page that has:

  1. A server connect sc1 that returns the a value called radius
  2. A variable call pi, that contains the value 3.14
  3. A paragraph that looks like this: Perimeter: {{ * pi.value * 2}} cm

When the page is rendered, and ignoring any syntax error in my example and assuming that sc1 returns a radius of 10, the following will be shown:

Perimeter: 62.8 cm

Assume now that

  1. I keep the text in 3 above in a database table
  2. I have a server connect sc2 that retrieves the value what is stored in the db table
  3. I set my paragraph to show the results of sc2 (probably by binding something like to the paragraph’s Dynamic Attributes > Display > Inner HTML)

The page will shows the string Perimeter: {{ * pi.value * 2}} cm as I saved it, i.e., without interpreting the values of the variables, and the page show look something like this:

Perimeter: {{ * pi.value * 2}} cm

The desired behaviour, is that if I bind the results of the server connect sc2 to the requested “inner parsed” option, the page will show

Perimeter: 62.8 cm

Now, since you made it up to this point, maybe I can add a small request to simplify the UI a bit.

Instead of having 3 options (inner text, inner html, and inner parsed) in the Dynamic Attributes > Display, maybe you could have only one and have two checkboxes inside it to select how the bound content will be treated (one to request interpreting any found html tags and the other to request interpreting any found bindings), maybe defaulting both to false, so the binding will be interpreted as simple text.

Many thanks!

(Don’t forget you can vote for your own requests)

I think this would be a very useful feature. I’ve done something like this by storing the ID of the {{}} string record in a session, and using PHP to inject this into the relevant part of the page at it were, eg:

<div dmx-repeat:repeat1="">
          <?php include 'dynamic_bindings.php';?>
1 Like

thank you Tom.

I actually had to hack some core files to get this working for bootstap validation messages. But it would be nice to have it included for all App Connect.

1 Like