uncheck checkbox if element is hidden

  • gee2803
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0

gee2803 created the topic: uncheck checkbox if element is hidden

Hello,

I have a form to collect mail and address of a user. The address is to get postal information.

Yes I want to get newsletter [ID Newsletter]
mail [ID mail]
Yes I want to provide my address [ID Adress]
street [ID street]

Now I am using visibility rules to show the initial hidden fields like
turn on element mail if Newsletter is !checked
turn on element street if Address is !checked
turn off element mail if Newsletter is !unchecked
turn off element street if Address is !unchecked

If a user unchecks the first checkbox Newsletter the state of address is still saved as checked, so if the user checks Newsletter again the street field is missing either if Address is checked.

How can I set Adress to unchecked if Newsletter is unchecked with visibility rules?
#235857
  • Posts: 2729
  • Karma: 93
  • Thank you received: 369

mihaela replied the topic: uncheck checkbox if element is hidden

Hello,

I am not completely sure what of the following two do you want to achieve:

1. Do you want that when someone unchecks the Newsletter, the entered Address is erased? Also when Newsletter is unchecked that street field is empty.

2. Do you want that checking and unchecking Newsletter field defines showing or checking the Address field?

Regards,

Mihaela
#235866
  • gee2803
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0

gee2803 replied the topic: uncheck checkbox if element is hidden

Hi. Option 2. I solved it this way now:
jQuery(document).ready(function(){

    jQuery("#bfElemWrap445").click(function(){
      jQuery("#ff_elem448").prop("checked", false);
    });

});
#235907
  • Posts: 2729
  • Karma: 93
  • Thank you received: 369

mihaela replied the topic: uncheck checkbox if element is hidden

Hello again,

Are you saying that you have solved the issue using the code from previous post, or this is just the code that you are using, but it is not working properly?

Regards,

Mihaela
#235940
  • gee2803
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0

gee2803 replied the topic: uncheck checkbox if element is hidden

Solved it this way.
#235950
  • Posts: 2729
  • Karma: 93
  • Thank you received: 369

mihaela replied the topic: uncheck checkbox if element is hidden

Great! I'm glad that you did.

Best regards,

Mihaela
#235959
Moderators: ForumSupporttomeperica
Time to create page: 0.076 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here