close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Add second condition to Insert Record Behaviour

Thread began 1/18/2023 3:31 am by s.joiner74419001 | Last modified 1/20/2023 8:58 am by Ray Borduin | 226 views | 6 replies |

s.joiner74419001

Add second condition to Insert Record Behaviour

I have an ‘Insert record behaviour’ that is triggered by a ‘form submit’. I would like to add a second condition so it only triggers if both conditions are met. I have constructed an ‘Access Rule’ that I would like to use as the second condition.

The ‘Access Rule’ uses a ‘Record Set’ on the page which basically constructs the following:

Allow If <?php echo($rsConsLeaseholders->getColumnVal("total_flats")); ?> <= 10
( see attached screen shot for settings )

So I want the insert to fail if ’total_flats’ is 10 or less.

I have tried to adjust the insert behaviour ‘if statement’ as follows:

From this - if (isset($_POST["submit-consent-sb"]) || isset($_POST["submit-consent-sb_x"])) {

To this - if (isset($_POST["submit-consent-sb"]) || isset($_POST["submit-consent-sb_x"]) && (WA_Auth_RulePasses("10orLess"))) {

But with the adjustment the ‘Insert Behaviour’ is still being triggered when the ’total_flats’ value is more than 10.

Where am I going wrong here?
Page attached..

Thanks in advance!

Attached Files
consent-form-c.php
Sign in to reply to this post

Ray BorduinWebAssist

Access rules can't reference recordsets. I think you would be better off just updating the trigger itself instead of using an access rule in this case. If you attach the php file then I can show you the line to update and suggest code to use.

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

s.joiner74419001

What php file do you mean Ray?

Sign in to reply to this post

Ray BorduinWebAssist

The page with the insert record server behavior that you want to add the second trigger to.

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

s.joiner74419001

I attached it on my first post..consent-form-c.php. I'm wanting this on numerous triggers on this page. you can show code suggestion on the insert starting on line 130. for the reg_owners_security table insert triggerd by - isset($_POST["submit-consent-s"]

Sign in to reply to this post

Ray BorduinWebAssist

Change your trigger on line 71 from:

if (isset($_POST["submit-consent-s"]) || isset($_POST["submit-consent-s_x"])) {

to:

if (isset($_POST["submit-consent-s"]) && $rsConsLeaseholders->getColumnVal("total_flats")) <= 10) {

That should do what you want... Let me know if you need any more assistance.

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

s.joiner74419001

Thanks ray.. I had to make a slight adjustment to your code. there was one to may parentheses being used. so I tried the following:

if (isset($_POST["submit-consent-s"]) && $rsConsLeaseholders->getColumnVal("total_flats") <= 10) {

This now works fine.

Many thanks:

Sign in to reply to this post

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...