close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Using Update Behavior Custom PHP Data Edits

Thread began 4/01/2016 2:10 pm by TonyE | Last modified 4/05/2016 4:53 pm by Ray Borduin | 298 views | 4 replies |

TonyE

Using Update Behavior Custom PHP Data Edits

I created an update behavior to update my database and moved it further down in my program and wrapped it in my custom PHP code to perform data edits. Updates to my database worked fine at first using the update behavior and my PHP code. However, when I used WebAssist to add several more fields to update, it deleted my custom PHP code and moved the update behavior back to the beginning of the program. I can't find anywhere in WebAssist documentation or tutorials that illustrate how to do use custom PHP eidts and only do the update if it passes all custom PHP edits.

Sign in to reply to this post

Ray BorduinWebAssist

It shouldn't mess with your updates as long as you add them in their own php code chunks... so it would look like:

<?php
//your custom code
?>
<?php
// code produced by the Server behavior
?>
<?php
// more custom code

as long as you add them to their own code section they shouldn't be messed with.

(btw I noticed you have some blank lines in your code between ?> and <?php on the top of the page... that can cause issues in php and the blank lines should be removed)
?>

Sign in to reply to this post

TonyE

Using Update Behavior Custom PHP Data Edits

Ray, thanks for your quick response. I understand what you're saying in your reply. What I don't understand is how do I make the update behavior conditional based upon the form fields passing my PHP edits? I thought enclosing the update behavior within an IF statement would work. But, you're saying the update behavior has to be kept in it's own code chunk. Plus, when I updated the behavior it deleted my code. I'm thinking I can use a "hidden" field on the form and update it to say the edits passed or failed. Then test the "hidden" field using the Trigger feature of the update behavior. However, since the Trigger feature using the Lightning Bolt (dynamic) is not adequately explained I have no idea what to put there. Do I put an IF statement, just the "hidden" field or what? Any insight you have on using the Trigger feature would be appreciated. If none of this is viable my other option is to just create another program to do the updates when the form is properly edited. I wanted to say away from this option, if possible. The bottom line is that I don't want the update behavior executed if any field does not pass my edits.

Sign in to reply to this post

Ray BorduinWebAssist

You can still wrap it in an IF statment:


<?php
if ("this" == "that) {
?>
<?php
// code produced by the Server behavior
?>
<?php
}
?>

Sign in to reply to this post

TonyE

Ray, your suggestion worked fine. I had the right approach but didn't wrap the Server behavior correctly. Thank you so much!

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