FX Insert Multiple Records -
(by Felice Di Stefano)
(support for PHP_MySQL, PHP_ADODB, ASP_Js, ASP_Vbs)
This server behavior will
allow to insert multiple records into a table at one time. It can be used
also as a normal insert.
The main purpose of this behavior is to insert all the items from
a list, created by the Insert Repeat region, with one click.
Applying
Create a form on the page with the required form elements, open the FX Insert Multiple Records from the server behaviors palette and apply the parameters. Then select the area to repeat and apply the supplied Insert Repeat server behavior defining how many rows you want to be available. (It would be recommended to apply the Insert Repeat after the Insert Multiple).
| Form: | Select the form which will perform the insert. |
| Connection: | Select the connection to use for this action. |
| Insert into Table: | Select the database table where to insert the items. |
| Fields in Loop: | Select the form element to bind to the table column in the dropdown below then select another form element and make a new binding and so on for any element to use in the update action. |
| To Column: | After
selecting a field from the list above select a column from this list which
will be bound to the selected field then repeat the operation for any field
used in the update action. This list includes the "-checkrow-" dummy column which is used in case you want to add a checkbox in the form to allow the insert. If you wish so assign the checkbox to this column. |
| Checkbox Alt Value: | This field is enabled only when the selected element is a checkbox and permit to define the alternative value. 0 or empty string is assumed by default depending on the column definition therefore you don't need to insert the 0. Note that if in a row is set just an alternative value other then 0 numeric or string the row will never be considered completely empty and it will be inserted since the alternative value is considered as an input. If you don't want this happen leave the blank default value. You are free to use any value of course, be coherent with the checked value, if one is Yes the obvious opposite is No, or Accepted and Not Accepted, or 1 and 0 and so on. |
| Exclude from Check: | The insert code checks that an insertion row is not completely empty to be inserted otherwise will be skipped, now it may happen that you may have some of the fields containing a default value but you want the record to be inserted only if some of the other fields are filled. In this case you may select in this list the fields you don't want to be checked so that the row will be skipped if none of the other fields are filled. |
| Submit Button Name: | Select the button which will submit this action. |
| Redirect To: | At the end define where to redirect after inserting, to redirect to the same page you may insert the same page name or even leave it empty. |
Hints
You may use it to insert a single item.
Note that it is not required to fill all available fieldsets, any fieldset which is completely empty will be skipped.
by FELIXONE