Page 1 of 1

setting values on hyperlink onclick

Posted: Wed Oct 19, 2011 11:40 am
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>

Re: setting values on hyperlink onclick

Posted: Sat Oct 22, 2011 3:01 pm
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.