TOPIC:

Conditional Hidden Field 2 weeks 1 day ago #277662

  • Topic Author
  • ducman
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 110
  • Thanks: 0
Good morning, a long time ago I got (now I don't remember how) that this code that hides a field depends on the option "YES" and "PENDING" but now I can't, could you help me please?

Thank you!!


if( jQuery("#cb_500").val() !='YES'|'PENDING') {
jQuery("#cb_494").parent().parent().parent().hide(); }

var el = jQuery("#cb_500").on('change', function(){
if( jQuery("#cb_500").val()=='SI'|'PENDING') {
jQuery("#cb_494").parent().parent().parent().show(); }
else {
jQuery("#cb_494").parent().parent().parent().hide();
}
});

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

Conditional Hidden Field 2 weeks 1 day ago #277663

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

did you add this code in Init (JS)? and instead of "cb" you can put name of elements

UPDATE: something like this:
var el = jQuery(contentbuilder._("a")).on('change', function(){

    if(  jQuery(this).val() =="SI" || jQuery(this).value()=="PENDING" ){
jQuery(contentbuilder._("b")).show();
       
    }
else {
jQuery(contentbuilder._("b")).hide();
}

});
where a is name of your element (not title), and b too

or like this:
if( jQuery("#cb_500").val()!='SI' || jQuery("#cb_500").val()!='PENDING') {
jQuery("#cb_494").parent().parent().parent().hide(); }

var el = jQuery("#cb_500").on('change', function(){
if( jQuery("#cb_500").val()=='SI' || jQuery("#cb_500").val()=='PENDING') {
jQuery("#cb_494").parent().parent().parent().show(); }
else {
jQuery("#cb_494").parent().parent().parent().hide();
}
});

Regards,
Tihana

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

Last edit: Post by tihana.krivic.

Conditional Hidden Field 2 weeks 1 day ago #277665

  • Topic Author
  • ducman
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 110
  • Thanks: 0
Perfect, thanks for the help!

Another small problem I have is that I need to join two fields (select) in one of text, I have searched and seen your code but it gives me an undefined error, what could it be? Thanks again.

your code:

contentbuilder.onSubmit(
function(){
contentbuilder._('Presenter').value = contentbuilder._('PresenterFirst').value + ' ' + contentbuilder._('PresenterLast').value;
return true;
}
);

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

Conditional Hidden Field 2 weeks 1 day ago #277667

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

did you try like this:
contentbuilder.onSubmit(
function(){
var tmp= contentbuilder._('nameoffield1').value + ' ' + contentbuilder._('nameoffield2').value;
contentbuilder._('nameoffield').value = tmp;
return true;
}
);
-nameoffield1 and nameoffield2 are names of field which you want to "connect"
-nameoffield is name of field in which you want to show result of connection

Regards,
Tihana

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

Conditional Hidden Field 2 weeks 1 day ago #277670

  • Topic Author
  • ducman
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 110
  • Thanks: 0
If I put that code, the text field appears with the words "undefined undefined" just like with the other code.

Cheers!

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

Conditional Hidden Field 2 weeks 1 day ago #277671

  • Topic Author
  • ducman
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 110
  • Thanks: 0
I just did the test with two text fields and it does work, it is with the select fields where it fails.

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

Moderators: ForumSupport
Time to create page: 0.052 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!