close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dependent form fields not inserted correctly.

Thread began 5/27/2021 1:40 pm by Jonas | Last modified 5/28/2021 8:47 am by Ray Borduin | 306 views | 3 replies |

Jonas

Dependent form fields not inserted correctly.

I have a form that is divided into two parts.

Depending on what the user selects in the first select menu - different fields are then displayed (using a show-hide javascript).
There are two choices in the select menu (approved, not approved). If "not approved" is selected, the text field: "reason" is displayed. But if "approved" is selected, other fields are displayed instead. When the submit button is pressed, data should be inserted into three different tables. This works if you select "approved". But for some reason I do not understand, the submit button does not work if you select "not approved". I suspect it has something to do with the validation. But I think the javascript that handles show-hide is correct. Could there be some conflict between the validation scripts? Can you help me figure this out?

I have tried to create a rule that is used in the Insert records, maybe this is the problem?
<? php
if ((WA_Auth_RulePasses ("add bucket approved")) && (isset ($ _ POST ["bucketAddTips"]) || isset ($ _ POST ["bucketAddTips_x"]))) {...
But this does not help.

Sign in to reply to this post

Ray BorduinWebAssist

Your trigger includes a check for:
WA_Auth_RulePasses("add bucket approved")

I'm guessing that might be the cause, but I can't tell without looking at the rule definition.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

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.

Sign in to reply to this post

Ray BorduinWebAssist

I think this is too complicated to answer through the forum. You would need to sign up for premier support and I would have to debug this live in a screen sharing session to figure out what you are trying to do and where it is going wrong.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...