close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

multiple insert from a checkbox list

Thread began 3/15/2019 11:28 am by gb261593 | Last modified 3/19/2019 5:06 pm by Ray Borduin | 54 views | 13 replies |

gb261593

multiple insert from a checkbox list

I have a database used to manager free legal advice. I have a table 'advicetype' which has fields workid and notes. Also a table 'advice' which, amongst others, has fields adviceid
and matterid.

During the advice process I want to be able to list all of the advicetype notes in a table with a checkbox next to each of them. This would allow a user to check all of the advice types that apply for that session. On clicking Submit this would then insert each of the checked items into a new record in table jumcmatteradvice which has fields including workid.

Is this possible using Data assist?

Sign in to reply to this post

Ray BorduinWebAssist

Yes. You can do that with the multiple insert server behavior.

Sign in to reply to this post

gb261593

Are there any detailed instructions anywhere that have checkboxes mentioned?

Sign in to reply to this post

Ray BorduinWebAssist

Not that I know of. Checkboxes work exactly the same as any other input element, so their would be no reason to do a tutorial specific to checkboxes.

If you are using MySQLi, then you don't even need to use multiple insert. The standard insert server behavior will work with arrays like checkbox groups.

Just:

1) Add your checkbox to the page and name it with brackets like: <input type="checkbox" name="toinsert[]">
2) Bind the value of the checkbox to the recordset and use a Repeat Region Server Behavior to repeat the recordset for all of the rows
3) Apply the insert server behavior and use the "array" version of the checkbox to insert and one row will be inserted for each value checked automatically.

The best thing to do is try and post here when you get stuck.

Sign in to reply to this post

gb261593

Thank you. I will try this and get back to you if necessary.

Sign in to reply to this post

gb261593

Many thanks - this works perfectly. My only issue is with the repeat selection part. (I am following the tutorial at http://www.webassist.com/tutorials/Create-a-multiple-record-insert-form). During this you have to select a number of repeats. My recordsets are variable in length so I enter a number that is the largest (70 in my case) . This is OK but leaves blank lines at the end. Do I have to have a number there and if I do how can I get it to just be the max I need? I think the line is

$RepeatSelectionCounter_1_Iterations = "70";

Sign in to reply to this post

Ray BorduinWebAssist

Use repeat region instead of repeat selection and then you can have it repeat on all records in a recordset.

Sign in to reply to this post

gb261593

I tried that. I used the Repeat Region from the standard DW menu not anything from DataAssist. The list was OK but it only inserted one record.

Sign in to reply to this post

Ray BorduinWebAssist

I'll need to see a copy of the page to determine what is wrong. Are you using MySQL or MySQLi?

Sign in to reply to this post

gb261593

I am using mySQL. I have sent you the page in question. Many thanks

Sign in to reply to this post
loading

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