I created this rule from Access Rules Manager.
Instead of the following code that triggers the insert records:
"… If (isset ($ _ POST [" bucketAddTips "]) || isset ($ _ POST [" bucketAddTips "]))…",
which in plain language means: "if the button called 'bucketAddTips' is pressed", I added this rule ((WA_Auth_RulePasses ("add bucket approved")), so that it instead became:
”… If ((WA_Auth_RulePasses (" add bucket approved ")) && (isset ($ _ POST [" bucketAddTips "]) || isset ($ _ POST [" bucketAddTips ”])))…”
which in plain language means: "if the select list called 'approvedChoice' is equal to 1, and if the button called 'bucketAddTips' is pressed". But this does not seem to help. It is still not possible to send the form if the selection from the select list is 0. So I suspect that this rule that I added has no effect? But it would have been interesting to know if the code is written correctly?
———
I realize that my question is complicated, so I will try to be as clear as I can. Here I clarify how I intended.
I have three tables in the database that the current form should write to. "BucBuckets", "bucBucketsLan" and "bucTipsAdmin".
If the selection in the select list is equal to 1, the contents of the form are written to all three tables. But if the selection is equal to 0, the content should only be written to table "bucTipsAdmin". Because the field shown is linked to that table, see below (reason).
I have created a select list where the choice you make affects what you can fill in afterwards.
Technically, I have used a javascript that I modified (see: https://www.solodev.com/blog/web-design/how-to-hide-form-fields-based-upon-user-selection.stml).
If you select "Approved" (1), several fields are displayed.
But if you select "Not approved" (0), only a text field: "Reason", is displayed.
If you think that "not approved" is selected and you fill in "Reason" (which is required), and press send - then the content should be written to the table bucTipsAdmin. But this does not work. The button does not work.
If, on the other hand, you think that "approved" is selected and you fill in the fields that are required, and press send - then everything is written correctly.
I suspect that instead it has something to do with the validation. That it collides in some way?
I do not know if I do everything too complicated. If you have any simpler suggestions on how to build this functionally, I would be grateful.