Javascript Variable dmx-parse dynamic variable in JS

Hello Wappler,
I have looked at the community docs but not getting this to work

<div class="btn card-footer btn-primary text-center pt-0 pb-0 ps-0 pe-0 border-0 bg-info w-auto h-auto rounded-bottom mouse-hover" alt="" 
dmx-on:click="showProfile.show();filterConsSearchModal.load({id: userIDkey.value})" 
onclick="javascript:window.history.pushState('somevar', 'Title', 'profile.php?id'+dmx.parse('userIdentity.data.userid'));">

Should the onclick JS move into the dmx-on:click? Or is there something missing in the +dmx-parse(’’);?

Thank you for any help :slight_smile:

No, dmx-on:click is used for dynamic events only, i.e. the events available in App Connect.
onclick is used to call static events, i.e. javascript function.

So what is wrong here? Do you see any errors in the browser console? Can you explain the issue you are having in details?

The onclick is to execute native javascript, in your example you should remove the javascript: part, that is something for on a href. The dmx-on:click executes an App Connect expression, it is to execute actions from components on your page.

The onclick becomes: onclick="window.history.pushState('somevar', 'Title', 'profile.php?id'+dmx.parse('userIdentity.data.userid'));"

1 Like