On Click Button to URL

I’m trying to add a button to a dynamic card that list user details. This button when clicked will go to another page that will display the users details.

This is that the button looks like: dmx-on:click=“browser1.goto('update_visitor.php?= visitor_id )”

Do I need to insert the visitor_id with an Inner HTML? If so, in the Dynamic Attribute, do I select VALUE or NAME?

If neither, what do I do to insure the ID is used to in this URL link?

Thanks for your suggestions!

Hello,
Why are you using an onclick event? Why not using an anchor button with a dynamic link?

The main reason was to see if it was possible. Otherwise, the reason was ‘code aesthetics’ due to my use of the same on all the other buttons in the div array. :blush:

Thanks for clearing it up. I appreciate it!

browser.goto requires the static part to be wrapped in single quotes, like:
browser1.goto(‘update_visitor.php?=’ visitor_id )

Cool, I’ll give it go…

Nevertheless, your anchor suggestion works fine too.
dmx-bind:href=“update_visitor.php?id={{visitor_id}}”

So, you showed me there are two options are available. Thanks!

1 Like

For links it’s always better to use dynamic URLs :slight_smile: no logical reason to use goto behavior.
Goto is good for dynamic events - success, error etc.

1 Like

Here’s a code snippet I used successfully to display a bootstrap 4 button in a dynamic table complete with dynamic query string values. Works great and very easy to implement.

Detail

Code got zapped so I’ll try here without some markup. (chevron) replacing html caret…

                (chevron) a class="btn btn-primary" href="#" dmx-bind:href="otherpage.html?OrderID={{tidy1.data.query1[0].sessid}}" role="button"(chevron) Order Detail (chevron)/a(chevron)
              </td>

oops my mistake sorry, I copied the code from a bad page here is the working code I meant to show, (Again changing caret marks)

<a class="btn btn-primary" href="#" dmx-bind:href="ordersdetail.html?orderid={{orderid}}" role="button"  (closing caret) Detail (opening caret) /a>
2 Likes

Inline code formatting

Surround a section of code with backticks (`) for inline code formatting.

Multi-Line Blocks of Code

Surrounding code with three backticks (```) will allow for code to span multiple lines

9 posts were split to a new topic: Login Form Problems

A post was merged into an existing topic: Login Form Problems