TOPIC:

How to make multi fields required if 1 check box is checked? 3 days 10 hours ago #249707

  • GalanopD
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 34
  • Thanks: 1
Hi,

I am using your example in my form but instead of checkboxes I have radiobuttons.
It doesn't seem to work...

Thanks

Please Log in or Create an account to join the conversation.

How to make multi fields required if 1 check box is checked? 1 day 22 hours ago #249723

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 1658
  • Karma: 3
  • Thanks: 149
Hi,

I create an example for you.

File Attachment:

File Name: radio_required.zip
File Size:6 KB

Please download->unzip and install it (BF->Configuration->Package Installer->select file->Install Package). After that you will find form in Manage Forms.

I added:
1) radiobutton group->with name A
2) textfield -> with name B

Go to textfield->Properties->Validation->check Custom:
function ff_B_validation(element, message)
{
   let A = 'A'; // name, not title
     let checkboxes = JQuery("[name=\"ff_nm_"+A+"[]\"]:checked");

     if(  checkboxes.length > 0 ){  

         if( element.value.trim() == '' ){ // simple validation if the textfield is empty.

             if (message=='') message = element.name+" faild in my test.\n"
             ff_validationFocus(element.name);
             return message;
         }
     }
     return '';
} // ff_B_validation

Replace A with name of your radiobutton group (not title).
Replace B with name of textfield (not title).

Let me know if you need more help

Regards,
Tihana
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

How to make multi fields required if 1 check box is checked? 14 hours 26 minutes ago #249817

  • GalanopD
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 34
  • Thanks: 1
Thank you Tihana!
My mistake was to copy paste from the previous answer and I didn't notice that the "function" in the beginning, was missing... that was causing the Next Page button not to work!

Please Log in or Create an account to join the conversation.

How to make multi fields required if 1 check box is checked? 14 hours 20 minutes ago #249818

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 1658
  • Karma: 3
  • Thanks: 149
Hi,

ok.
I'm glad everything's fine now :)

Regards,
Tihana

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.049 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!