close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Update/Insert master table and m-to-m in the same form

Thread began 5/08/2012 11:13 pm by info4753 | Last modified 5/09/2012 1:50 pm by info4753 | 820 views | 2 replies |

info4753

Update/Insert master table and m-to-m in the same form

I'd like to create a form to update/insert a master table and in the same form (with checkboxes) update a corresponding many-to-many table.

Are there any tutorials or hints around how to accomplish this with the new version?

Thanks for any help.

Sign in to reply to this post

Jason ByrnesWebAssist

for this you would use the DataAssist Manage Relational Table behavior on the insert and update pages.


start by running the DataAssist to create the pages to manage the main table.

after the pages are created, you will need to create a recordset to query the table that contains the available options to return the option ID and Option name.


Add a checkbox to the page, set the label to use the option Name column from your recordset, and set the value of the checkbox to use the ID column, for example:

php:
<?php echo $row_recordsetName['NameColumn']; ?><input name="options" type="checkbox" id="options" value="<?php echo $row_recordsetName['IDColumn']; ?>">



then add a repeat region around the checkbox to loop through the option recordset.


you will need to add the recordset and checkboxes as outlined above on both the insert and update pages.

now, for the insert page:
open the server behaviors tab, and double click the Insert Record behavior. Make sure that the insert does not have a redirect set, if it does, remove the redirect. Then look in the Save inserted ID as a Session Section, and make note of the Store As setting, this is the session that will save the ID. Click cancel to close the insert behavior, then open the bidings panel, expand the session collection and make sure there is a binding there with the same name from the Store As section of the Insert behavior. If not, you will need to create one: Click the plus button and select Session Variable, use the name from the Store As section of the Insert behavior.

now go back to the server behaviors panel, click the plus button and select WebAssist -> DataAssist -> Manage Relational Table.


On the First screen select the relational table.

On the next screen select the column that relates to the main table, click the lightning bolt for Value and select the session that is created by the insert behavior.

On the next screen select the column that relates to the option table the options form field should already be set to use your checkbox.

the final screen allows to double check the setting before clicking finish.


On the update page, the steps for applying the MRT behavior will be very similar with one major difference:
The update page uses a Querystring variable to set which record to update.

open the update page in a browser to update a record and make note of the address in the address bar, especially the Querystring variable, for example:
update.php?ItemID=34

the query string variable name in this example is:
ItemID

On the bindings panel, expand the URL Section and make sure there is a binding of the same name. If not, create one: Click the plus button, select URL Variable and use the name from your address bar.

in the second screen of the manage relations table behavior where you select the column that relates to the main table, click the lightning bolt for Value and select the URL Variable. all of the other settings will be the same on the update page.

Sign in to reply to this post

info4753

Thx Jason!

I'll give it a try.

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