How To Add ?id={{ID}} Link

I hope this makes sense of my current situation…

I have two buttons that are shown or hid depending on whether an ‘id’ exists in a table record. If no ‘id’ exists, a button indicates the page needs to be initiated. If the ‘id’ exists, a button indicates the page can be updated.

Additionaly, each button uses the dmx-on:click="browser1.goto(‘xxxxxxxxxxx’). Everything workds fine and delievers the user to the appropiate page. However, as soon as I add the suffix ?id={{xxxxx}} to the update link, the button fails to respond to mouse clicks.

I obviously don’t know how to arrange the quotes because it appears it turns the dynamic code to a string. I’ve tried dmx-on:click=“browser1.goto(‘xxxxxxxxxxx?id=’{{xxxxx}}”).

Maybe I can’t pass the ID in the URL with the browser.goto… Or maybe I am missing the proper syntax when mixing {{}} with the strings. Nevertheless, what is the rule when using the combination of this type of button link?

Below is the current button configuration used on the page. I’ve tried every combination, and now I’m turning to the experts!

Thanks for any help or suggestions.

The current button code…

 To Do

 Update

Hello JR,
Is there a specific reason why do you use a button with goto action, and not just an anchor button with dynamic href?

To answer your question - the single quotes must wrap the static content only, and the dynamic content there does not require {{ }} to be used. Example:

dmx-on:click="browser1.goto('staticurl?id='+dynamicID)"

and when used with dynamic href:

dmx-bind:href="'staticurl?id='+dynamicID"

Ha! Frankly, I don’t know when to use one or the other. I guess, with my lack of knowledge, I usually migrate to what little I know. Ha!

Does the dmx-bind:href hide the url from the user as the dmx-on:click=" "?

I know that need an in-depth lesson on all these extra ‘dmx-’ options that are available, and when to use the best for the need at hand… Nevertheless, THANK YOU for the mini-lesson today!

No, it doesn’t :slight_smile:

I’d rather they be hidden if possible. Thanks for the confirmation!

1 Like

So I see that I overlooked the use of the ‘+’

Great lesson. Thanks again!

1 Like

Hi All,

How to implement this when I have more than two variables?
I have tried several combinations but no luck so far…

Thanks!

You just need to wrap static parts in single quotes:

dmx-bind:href="'staticurl?parameter=' + dynamicValue1 + '&anotherParameter=' + dynamicValue2
3 Likes

Excellent Teodore as usual ! the second ‘+’ was actually missing.

1 Like