Skip Navigation

[Resolved] Form options

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to validate the CRED form

Solution:
you can use the CRED hook cred_form_validate to validate the form.

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/form-options/#post-842784

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

This support ticket is created 6 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 6 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#840398

Tell us what you are trying to do?
I want a form that will allow visitors to submit new content. However, I'm facing few issues and have further questions:

-I want Utisak name and Kompanija to always have the same value, but to appear in the form only once.
-I have problems with translating messages. Even though I translated those in the form, I still see warning messages in English
-Can I limit form submissions to people from certain countries only?
-On checkbox, I want to link part of the text to another page (terms and conditions)
-Email address label is not showing
-Can I limit submissions per day based on IP address?
-Can I use Smart Captcha (the one that appears only when the form is abused)
-How do I add text over drop-down menu without choosing one as a default?

You can see the current form I'm testing at nikadvise.com/test

#842784

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - as per our support policy, we entertain only one question per support ticket. This will help other users searching on the forum and help us to write proper resolve ticket summery.

I will try to answer as many queries from following question. Kindly open a new ticket for each new question. Thank you for understanding.

-I want Utisak name and Kompanija to always have the same value, but to appear in the form only once.
=> As I understand, you want to assign identical values to both fields having one of the fields on form, so you can use CRED hook - cred_before_save_data and adjust your field value.

For example:

add_action('cred_before_save_data', 'my_before_save_data_action',10,1);
function my_before_save_data_action($form_data){
    // if a specific form
    if ($form_data['id']==9999){
        if (isset($_POST['wpcf-custom-field-1'])){
            $_POST['wpcf-custom-field-2'] = $_POST['wpcf-custom-field-1'];
        }
    }
}

More info:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_before_save_data

-I have problems with translating messages. Even though I translated those in the form, I still see warning messages in English
=> Kindly open a new ticket and share all required information.

-Can I limit form submissions to people from certain countries only?
==> There is no such native feature exists but if you want to validate your form with custom script, you can use the CRED hook cred_form_validate to validate the forum. You should add your custom script to check the IP based on country.

More info:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

-On checkbox, I want to link part of the text to another page (terms and conditions)
==> You can use CRED generic field checkbox and add anchor with title. For example:

[cred_generic_field field='terms-conditon' type='checkbox' class='' urlparam='']
{
"required":1,
"validate_format":0,
"checked":1,
"default":"1",
"persist":1,
"label":"<a href='www.abc.com'> Terms and Conditions </a>"
}
[/cred_generic_field]

-Email address label is not showing
==> Please open a new ticket with all required information.

-Can I limit submissions per day based on IP address?
==> Again, there is no such native feature exists but if you want to validate your form with custom script, you can use the CRED hook cred_form_validate to validate the forum. You should add your custom script to check the IP based on country.

-Can I use Smart Captcha (the one that appears only when the form is abused)
==> CRED offers normal captcha. There is no smart captcha feature available.

-How do I add text over drop-down menu without choosing one as a default?
==> Please kindly open a new ticket with all required information.