Logic involving knowing when a form is ready to be submitted

  • MHB
  • Thread starter find_the_fun
  • Start date
  • Tags
    Form Logic
In summary, the conversation discusses the use of IBM Form Experience Builder to create a survey form and the challenge of creating a rule for displaying a "Survey Complete" message. The limitation of using only AND and OR operations to combine rules is mentioned, and a logical expression is proposed to express the logic for displaying the message. The conversation also touches on the idea of using negation to express all Boolean functions and the potential limitation of only being able to combine rules with either AND or OR.
  • #1
find_the_fun
148
0
I am creating a form using IBM Form Experience Builder. I want to create a survey as follows (content in [] denotes possible answers)



  1. Do you still require a specified asset? [yes/no/I'm not the owner]
  2. Do you know who the owner is? [yes/no]
  3. Specify: []


Survey is complete


The questions are dynamic in the sense not all of them are shown, for example if the answer to 1. is yes 2. and 3. are hidden. The problem is creating a rule for displaying “Survey complete”. I can have an arbitrary number of rules but the relationship between them has to be all “logical or” or all “logical and”. I can specify if the message is hidden if conditions to 1., 2., 3. are met or are not met. I can't think of a way to do this but I remember learning in a math course that all logical operations can be derived from “and and not” or “or and not” which leads me to believe there is a way. Each rule can apply if a particular answer to a given question is given, or if no answer to a particular question is given (e.g. the user hasn't answered 1. yet so the rule to hide the message should apply)
 
Physics news on Phys.org
  • #2
Re: logic involving knowing when a form is ready to be submited

Evgeny is your man here, but I'll just say that you have to have a method of negation, or you cannot express everything. AND and OR together are incomplete. As you mentioned, NAND and NOR are complete. It looks like you have the ability to negate, since whether your "Survey Complete" message appears can be dependent on whether a condition is or is not met.

So it seems to me that your question is this: given that from one question to the next, you have to use only AND and OR, how do you express the logic that either displays or does not display the "Survey Complete" message. Am I right?

If so, could you give us the logical expression that seems natural to you? Then maybe we can translate it into something that IBM Form Experience Builder recognizes.
 
  • #3
Re: logic involving knowing when a form is ready to be submited

Ackbach said:
So it seems to me that your question is this: given that from one question to the next, you have to use only AND and OR, how do you express the logic that either displays or does not display the "Survey Complete" message. Am I right?

My interpretation of the situation is only (AND and NOT) or (OR and NOT) can be used. I say this because a rule is matched if a given condition is met or is not met, so that's negation. There can be either an AND or OR relation between all rules (e.g. a AND b AND c or a OR b OR c but not a OR b AND c). But the rest of your understanding is correct.

This is what I'd like to do but Forms Experience Builder only let's me use all \(\displaystyle \vee\) or \(\displaystyle \wedge\).

if
(1. matches yes \(\displaystyle \vee \) 1. matches no) \(\displaystyle \vee \) (1. matches I'm not owner \(\displaystyle \wedge\) 2. matches no) \(\displaystyle \vee \) (1. matches I'm not owner \(\displaystyle \wedge\) 2. matches yes \(\displaystyle \wedge\) 3. [user filled in name])
then display message
 
  • #4
Re: logic involving knowing when a form is ready to be submited

It is true that OR and AND alone are incomplete, but at least in the case of yes/no questions we have negation at the atomic level. That is, the rule that checks whether an answer to some question is "no" is the negation of the rule that checks whether an answer to that question is "yes". Every Boolean function can be expressed by a formula where negations apply to variables only (not to compound formulas built from OR or AND).

find_the_fun said:
There can be either an AND or OR relation between all rules (e.g. a AND b AND c or a OR b OR c but not a OR b AND c).
This seems to be a more serious restriction. If atomic rules (the answer to some question matches, or possibly does not match, a certain answer) can be combined either only by ORs or only by ANDs, then not all Boolean functions can be expressed. Out of two-argument functions, it seems that only $p\leftrightarrow q$ and $p\oplus q$ (which are true iff the truth values of $p$ and $q$ are equal and, respectively, not equal) cannot be expressed. E.g., $p\leftrightarrow q=(p\land q)\lor(\neg p\land\neg q)$, so there are conjunctions under a disjunction. I would expect that the share of functions that cannot be expressed rises with the number of arguments.

find_the_fun said:
if
(1. matches yes \(\displaystyle \vee \) 1. matches no) \(\displaystyle \vee \) (1. matches I'm not owner \(\displaystyle \wedge\) 2. matches no) \(\displaystyle \vee \) (1. matches I'm not owner \(\displaystyle \wedge\) 2. matches yes \(\displaystyle \wedge\) 3. [user filled in name])
then display message
I don't see how this can be expressed without nesting AND inside OR.
 
  • #5
Re: logic involving knowing when a form is ready to be submited

Evgeny.Makarov said:
It is true that OR and AND alone are incomplete, but at least in the case of yes/no questions we have negation at the atomic level. That is, the rule that checks whether an answer to some question is "no" is the negation of the rule that checks whether an answer to that question is "yes". Every Boolean function can be expressed by a formula where negations apply to variables only (not to compound formulas built from OR or AND).

This seems to be a more serious restriction. If atomic rules (the answer to some question matches, or possibly does not match, a certain answer) can be combined either only by ORs or only by ANDs, then not all Boolean functions can be expressed. Out of two-argument functions, it seems that only $p\leftrightarrow q$ and $p\oplus q$ (which are true iff the truth values of $p$ and $q$ are equal and, respectively, not equal) cannot be expressed. E.g., $p\leftrightarrow q=(p\land q)\lor(\neg p\land\neg q)$, so there are conjunctions under a disjunction. I would expect that the share of functions that cannot be expressed rises with the number of arguments.

I don't see how this can be expressed without nesting AND inside OR.

Ok thanks. It is very possible that what I'm asking for is impossible to do, I wanted to confirm it before giving up on this approach.
 

FAQ: Logic involving knowing when a form is ready to be submitted

What is the purpose of checking if a form is ready to be submitted?

The purpose of checking if a form is ready to be submitted is to ensure that all required fields have been filled out and that the data entered is valid. This helps to prevent errors and allows for the smooth processing of the form.

How do I know when a form is ready to be submitted?

You can use JavaScript to check if all required fields have been filled out and if the data entered is valid. You can also use event listeners to trigger the submission of the form once it is ready.

What are some common methods for validating a form before submission?

Some common methods for validating a form before submission include using HTML5 form validation attributes, using JavaScript to check for empty or incorrect fields, and using regular expressions to check for specific patterns in the data entered.

What should I do if a form is not ready to be submitted?

If a form is not ready to be submitted, you can prevent the form from being submitted by using JavaScript to disable the submit button or displaying an error message to the user. You can also use event.preventDefault() to stop the form from being submitted.

How can I improve the user experience when checking if a form is ready to be submitted?

To improve the user experience when checking if a form is ready to be submitted, you can provide real-time validation by using JavaScript to check the data entered as the user is filling out the form. You can also provide clear error messages to help the user understand what needs to be corrected before the form can be submitted.

Similar threads

Back
Top