Hi all,
How to define, that if visitor has submitted the form once, it won’t show up again? If i use sample code, it wil keep showing on the page.
There should be something by default like “if consent_submitted” or something, hope you’ll understand me. The alert functionality is only after submitting, so after reloading, or navigate to other page, i cannot use that function.
Thanks a lot!
{exp:consent:form}
{consents}
<fieldset>
<dl>
<dt>{consent_title}</dt>
<dd>{consent_request}</dd>
</dl>
<label>
<input type="radio" name="{consent_short_name}" value="y" {if consent_granted}checked{/if}>
Toestaan
</label>
<label>
<input type="radio" name="{consent_short_name}" value="n" {if ! consent_granted}checked{/if}>
Weigeren
</label>
</fieldset>
{/consents}
<fieldset>
<input type="submit" name="submit" value="Save">
</fieldset>
{/exp:consent:form}
You need to wrap your form in a conditional tag like the below:
{exp:consent:requests consent="your-consent-name"}
{if consent_granted == 1}
{!-- do nothing because they have already consented --}
{if:else}
{exp:consent:form consent="your-consent-name" return="{current_url}/"}
{!-- your fields here --}
{/exp:consent:form}
{/if}
{/exp:consent:requests}
Hi Chris,
Looks like it works like it should! Thanks a lot, for others. This is the code i’ve used:
{if ! consent:has_responded:ee:cookies_performance}
<div>
<div>Cookies</div>
{exp:consent:form} {consents} <input checked="checked" name="{consent_short_name}" type="hidden" value="y" /> {/consents} <input name="submit" type="submit" value="Alles toestaan" /> <a href="#collapseCookie"> Zelf beheren </a> {/exp:consent:form}
<div>{exp:consent:form}
<div>{consents}
<div>
<div><strong>{consent_title}</strong></div>
<label> <input checked="checked" name="{consent_short_name}" type="radio" value="y" /> Toestaan </label> <label> <input checked="checked" name="{consent_short_name}" type="radio" value="n" /> Weigeren </label></div>
{/consents}</div>
<input name="submit" type="submit" value="Opslaan" /> {/exp:consent:form}</div>
</div>
{/if}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.