Change the event hooked to a themeable button

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
User avatar
jPaul
 
 
Posts: 88
Joined: Thu Jun 10, 2021 11:00 am

Change the event hooked to a themeable button

Post by jPaul »

Hi Everybody,
I have a Themeable Button on a website. The value of that button is established by a PHP variable:
Button value = "Log In" or Button Value = "Log Out".
Works fine.
So now the action to that button is dependant upon the value of $myLogValue I need to include this javascript to the
Themeable Button:

Code: Select all

var btnValue = $('myLogValue').val();
if (btnValue == 'Log In') {
	// Action for first value
	login.php;
} else {
	// Action for second value
	logout.php;
}
How can I go about inserting that code in the event tab of the Themeable Button?
Many Thanks,
-Paul-
If I wasn't so stupid, I wouldn't have to be so persistent.
User avatar
Pablo
 
Posts: 24421
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Change the event hooked to a themeable button

Post by Pablo »

You cannot insert completer scripts in an event, instead you will need to call function that is defined somewhere else on the page.
User avatar
jPaul
 
 
Posts: 88
Joined: Thu Jun 10, 2021 11:00 am

Re: Change the event hooked to a themeable button

Post by jPaul »

need to call function that is defined somewhere else on the page
Will you expand on this a little, please? ( I don't see anythiong like a run javascript )
Many Thanks,
-Paul-
If I wasn't so stupid, I wouldn't have to be so persistent.
User avatar
Pablo
 
Posts: 24421
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Change the event hooked to a themeable button

Post by Pablo »

Step 1
Add the function that implements your logic in Page HTML or a HTML Object.
For example;
<script>
function doSomething()
{
...
}
</script>

Step 2
Set the action of the event to 'javascript'

Step 3
In 'JavaScript' input field, use doSomething();
Post Reply