TOPIC:

[Résolu] conditions d'un bouton 1 year 10 months ago #235721

  • Topic Author
  • beheliod
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 29
  • Thanks: 0
Bonjour
Il est possible de mettre une condition pour faire apparaître ou non un bouton si on choisit une pagination personnalisée.
Mais est-il possible de mettre une condition multiple pour que le bouton apparaisse si une liste de questions définies est bien remplie

Par exemple quelque soit la réponse sur les boutons radios.
Si on répond au question 1,2,3 et 5 le bouton suivant apparaîtra
On ne prends pas en compte volontairement la question 4
Par avance merci pour votre aide.
Cordialement

Hello
It is possible to set a condition to make a button appear or not if you choose a custom pagination.
But is it possible to put a multiple condition for the button to appear if a list of defined questions is filled in?

For example, whatever the answer is on the radio buttons.
If we answer question 1,2,3 and 5 the following button will appear
Voluntary question 4 is not considered
Thanks in advance for your help.

Best regards

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

Last edit: Post by beheliod.

conditions d'un bouton 1 year 10 months ago #235738

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

It is possible to put a multiple conditions for the button to appear if a list of defined questions is filled in.

It can be done using JavaScript visibility rules as explained here crosstec.org/en/support/online-documenta...s-in-javascript.html .

To send you the correct code which will work as you want, I must know which type of elements are the questions. Are they all radio buttons?

Regards,

Mihaela

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

conditions d'un bouton 1 year 10 months ago #235782

  • Topic Author
  • beheliod
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 29
  • Thanks: 0
Hi Mihaela !
To your exemple I don't have any problem while there's only one condtion by question.

Personaly I prefer if my answers are :
question 1 = "yes" and question 2 = "yes", section "newsection" appears

But if question 1 = "no" and/or question 2 = "no", section "newsection" not appears and better, section 'othersection" appears

I hope I have been more specific in my request

Best regards

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

conditions d'un bouton 1 year 9 months ago #235979

  • Eddy.vh's Avatar
  • Eddy.vh
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 590
  • Karma: 4
  • Thanks: 97
Bonjour Olivier.

Je javascript permet l'utilisation d'opérateurs logiques "et" (&&) et "ou" (||).
Il faudra alors probablement écrire ton script dans l'onglet Scripts des options avancées de ton formulaire.

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

conditions d'un bouton 1 year 9 months ago #235994

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

Yes, as Eddie wrote in that case logical operators needs to be used for multiple conditions.
function ff_question1_action(element, action) {
    
          if (jQuery('[name="ff_nm_question1[]"]:checked').val() == "yes" && jQuery('[name="ff_nm_question2[]"]:checked').val() == "yes" )
          {
               bfToggleFields('on','section','newsection',bfDeactivateField);
          }
          else
          {
               bfToggleFields('off','section','newsection',bfDeactivateField);
          }
           if (jQuery('[name="ff_nm_question1[]"]:checked').val() == "no" || jQuery('[name="ff_nm_question2[]"]:checked').val() == "yes" )
          {
               bfToggleFields('on','section','othersection',bfDeactivateField);
          }
          else
          {
               bfToggleFields('off','section','othersection',bfDeactivateField);
          }
        
} // ff_question1_action
NOTE: In the code above you have to replace every instance of "question1" with the name of radio group element with the question 1. Also, you have to replace every instance of "question2" with the name of radio group element with the question 2.
Also, "newsection" and "othersection" have to be the names of the sections to show or hide.

Let me know whether this works as you wanted.

You need to put this code in Actionscript of second question as well.
Code there would look like this:
[code]function ff_question2_action(element, action) {
    
          if (jQuery('[name="ff_nm_question1[]"]:checked').val() == "yes" && jQuery('[name="ff_nm_question2[]"]:checked').val() == "yes" )
          {
               bfToggleFields('on','section','newsection',bfDeactivateField);
          }
          else
          {
               bfToggleFields('off','section','newsection',bfDeactivateField);
          }
           if (jQuery('[name="ff_nm_question1[]"]:checked').val() == "no" || jQuery('[name="ff_nm_question2[]"]:checked').val() == "yes" )
          {
               bfToggleFields('on','section','othersection',bfDeactivateField);
          }
          else
          {
               bfToggleFields('off','section','othersection',bfDeactivateField);
          }
        
} // ff_question2_action
[/code]

What this will do is it will show section "newsection" if both questions 1 and 2 are answered with "yes" and hidden otherwise. If one of the questions 1 or 2 is answered with "no" "othersection" will be shown.

The code has to be put in actionscripts of each element whose response determines which section is shown or hidden.

There is other option to put all the code in Initscript. Here crosstec.org/en/forums/15-usage/126099-s....html?start=6#235186 you can take look at the example.

Let me know whether this is working as you wanted and whether you have managed to set this for your form.

Regards,

Mihaela
The following user(s) said Thank You: beheliod

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

conditions d'un bouton 1 year 9 months ago #236059

  • Topic Author
  • beheliod
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 29
  • Thanks: 0
Hello
I hope it's ok
Thank you very much
Best regards

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

  • Page:
  • 1
  • 2
Time to create page: 0.051 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!