Hello
I created a generic checkbox for consent to the terms and the privacy policy for a user registration form. My problem is that in the user profile the checkbox doesn't appear checked and that means that it doesn't save the checked state. I copy the form code here and I also attach a screenshot of the user field.
[cred_generic_field type='checkbox' field='wpcf-consent']
{
"required":1,
"persist":1,
"default":1,
"label":"Sunt de acord cu <a href='<em><u>hidden link</u></em> și condițiile</a>, cu <a href='<em><u>hidden link</u></em> de confidențialitate</a> și îmi dau acordul pentru folosirea datelor mele personale pentru înregistrare."
}
[/cred_generic_field]
Thank you for contacting us and I'd be happy to assist.
The generic field option is used for virtual fields, that is for the fields which are not actually registered at Toolset -> Custom Fields.
As you want to store this consent confirmation in the database and have already registered a custom user field for this, in the user forms you'll use it as a regular field and not as a generic field.
Then please tell me how can I use HTML in the checkbox label. I need to link the terms and conditions and the privacy policy in the checkbox label. I tried, but it strips out the html.
I'm afraid, there is no built-in option available to achieve this, so it will require some workaround.
In your form's code below the consent field, you can include a special "span" tag and enclose the text and HTML content that you'd like to use with the field, within that span tag:
Example:
<span id="special-text" style="display:none;">Text and HTML for the label</span>
Please replace "Text and HTML for the label" with the actual text and HTML content.
And in the Form's JS editor, include the following custom script that will get the content from that special span tag and use it as the label for the consent field checkbox:
Thank you Waqar!
Could you help me to rewrite the jquery in a way that tha input is not disappearing too? It seems that the input tag is inside the label. hidden link
I also have a question related to this. You can see that above the consent I have two selects. The COUNTRY (Tara) select shows conditionally a corresponding generic field where I have the COUNTIES (Judet) as options separately for each country. I use the persist:1 and saves correctly the string in a simple user text field in the db. Is it alright to use this or should I have been using a jquery solution similar to the one you adviced me for the consent? I guess I've read somewhere that the persistent attribute is deprecated.