setting values on hyperlink onclick

General project discussion. NOT for help questions.
Post Reply
olumide
Forum Members
Forum Members
Posts: 108
Joined: Mon Mar 21, 2011 10:26 am

setting values on hyperlink onclick

Post by olumide »

Hello please can anybody help please, i have a code runing on a page assigning values to variables but i want it to only assign the values only when i click on a hyperlink.
Ok here is the problem the values get assign immediately i open the page even when hyperlink not clicked here is my code below for the page.

Code: Select all

<div id="registration">
<div style="height: 40px;">
<a id="reg" class="regbutton" onclick="{assign var='groupname1' value='individual'}{assign var='groupname2' value=''}" href="#">Individual Registration </a>
<br /> 
<a id="reg2" class="regbutton" onclick="{assign var='groupname2' value='School/Academy'}{assign var='groupname1' value=''}" href="#">School / Academy Registration</a> <br /> 
<a id="reg3" class="regbutton" href="#">Supplier Registration</a>
</div>
<br /> 
{if $groupname1 !=''} 
{cms_module module=SelfRegistration group="$groupname1" nocaptcha="1"}
{/if}
{if $groupname2 !=''} 
{cms_module module=SelfRegistration group="$groupname2" nocaptcha="1"}
{/if}

</div>
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: setting values on hyperlink onclick

Post by paulbaker »

Code like

Code: Select all

{assign var='groupname1' value='individual'}
gets executed by the server that is hosting your website. It executes the code whilst creating the page to serve to the visitor.

Explain what you are trying to achieve - there may be another way.
Post Reply

Return to “General Discussion”