TOPIC:

Mandatory field dependent on another 2 weeks 6 days ago #274923

  • Topic Author
  • caissier@scmf.ch
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 14
  • Thanks: 0
Hi,
I have a form with a section with 3 fields: Name, First name and Date of birth.
The 3 fields are not mandatory. But when the name is filled in, I would like the first name and date of birth to be mandatory as well.

How to solve this problem?
Can I implement a control on the next page button?

Thanks
Yves

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

Mandatory field dependent on another 2 weeks 6 days ago #274925

  • tihana.krivic's Avatar
  • tihana.krivic
  • Away
  • Moderator
  • Moderator
  • Posts: 10537
  • Karma: 3
  • Thanks: 705
Hi,

here is a solution.

Please go to date of birth field->Propertis->Validation->check Custom and put:
function ff_dateofbirthfield_validation(element, message)
{
   var name=ff_getElementByName('nameofNamefield').value;
   var calendar=element.value;
   if(name != '') {
if (message=='') message = "Please enter a birth date.\n"
        ff_validationFocus(element.name);
        return message;
    } // if
return '';
} // ff_dateofbirthfield_validation
Please replace :
-dateofbirthfield with name of calendar for date (not title)
-nameofNamefield with name of field for Name (not title)

If name if empty then date of birth is not required, but when someone put name then date of birth is required

If you need more help let me know

Regards,
Tihana

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

Last edit: Post by tihana.krivic.
  • Page:
  • 1
Moderators: ForumSupport
Time to create page: 0.044 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!