insert form inside another insert form?

Any tips and tricks that has to with the ADDT that doesn't fit into one of the other categories
antonio
Posts: 77
Joined: 2010-09-28 11:48

insert form inside another insert form?

Post by antonio » 2011-12-22 15:23

Hi all,
I have another problem here.
I have an insert form on a page (custom form).
This form colletcts some info and then save them in session vars.
Some of the form fields (optionally) should be inserted in a db table.

Example:

Code: Select all

field11
field12
field13
field14
field15
field20 [dropdown (dynamic, based on db table)]: will populate fields 21, 22, 23, 24, 25 
field21 (multi-field drop-down)
field22 (multi-field drop-down)
field23 (multi-field drop-down)
field24 (multi-field drop-down)
field25 (multi-field drop-down)
All fields will be saved in session vars.
The user is free to edit all fields (expecially 21, 22...).
I would like to allow the user to save the modified fields 21, 22... in a db table (the same db table that will populate field20 dropdown menu).

I hope this is clear enough.

Thanks in advance for any suggestion.

tony

antonio
Posts: 77
Joined: 2010-09-28 11:48

Re: insert form inside another insert form?

Post by antonio » 2011-12-22 15:53

antonio wrote:Hi all,
I have another problem here.
I have an insert form on a page (custom form).
This form colletcts some info and then save them in session vars.
Some of the form fields (optionally) should be inserted in a db table.

Example:

Code: Select all

field11
field12
field13
field14
field15
field20 [dropdown (dynamic, based on db table)]: will populate fields 21, 22, 23, 24, 25 
field21 (multi-field drop-down)
field22 (multi-field drop-down)
field23 (multi-field drop-down)
field24 (multi-field drop-down)
field25 (multi-field drop-down)
All fields will be saved in session vars.
The user is free to edit all fields (expecially 21, 22...).
I would like to allow the user to save the modified fields 21, 22... in a db table (the same db table that will populate field20 dropdown menu).

I hope this is clear enough.

Thanks in advance for any suggestion.

tony
Just to semplify it a bit. I found the editable drop-down server behaviour.
If you only could be able to insert some other related fields in the db, this should be fantastic.
The example above would be as follow:

Code: Select all

field11
field12
field13
field14
field15
field20 [editable dropdown] (will populate fields 21, 22, 23, 24, 25)
field21 (multi-field drop-down)
field22 (multi-field drop-down)
field23 (multi-field drop-down)
field24 (multi-field drop-down)
field25 (multi-field drop-down)
When you edit the value in the editable drop-down menu and the add button is enabled, once you click it the entries in fields 21, 22, 23... would be saved in the db along with field20.

Is this possible?

TIA

tony

antonio
Posts: 77
Joined: 2010-09-28 11:48

Re: insert form inside another insert form?

Post by antonio » 2011-12-23 14:12

I think I'm near to the solution (crossing fingers!!!).

Here is the sample of my application:

field20 (dropdown menu)
field21 (multi-field drop-down)
field22 (multi-field drop-down)
field23 (multi-field drop-down)
field24 (multi-field drop-down)
field25 (multi-field drop-down)

MAIN SUBMIT BUTTON (it submits the whole form (containing lots of other fields)

ADDED BUTTON "Add as:" and set his id and name to KT_custom2 (so that it doesn't overlap with KT_custom1 already in the page);
ADDED text FIELD (name: GroupName) so that the user can insert the name that will appear in the dropdown menu (field20);

- I completely removed the editable drop-down behaviour since it is too difficult to customize (it even doesn't work in chrome or safari).
- added an insert transaction and linked it to KT_custom2
- removed the ID field from insert transaction (to not get 'duplicate entry' db error)
- added a field /GroupName) to allow the user to enter a name that will appear in the dropdown menu
- set the destination page for the insert transaction to the same page (leaving this empty doesn't refresh the page)

This way it work almost beatifully but it has few quirks:
- if I add a validation behavior to not allow an empty GroupName field a validation error appear when I click MAIN SUBMIT BUTTON and not only when I click the "ADD as" button.
A partial solution I found is to set the related db field to NOT NULL and remove the validation behaviour.

Now when the user clicks "ADD as" and the field GroupName is empty a DB error is triggered. Not so elegant but it works.
If you find a better solution please let me know.

TIA for any comment

tony

jlig
Posts: 35
Joined: 2010-07-09 16:17

Re: insert form inside another insert form?

Post by jlig » 2012-04-20 21:54

Antonio, be sure to check out the following link:
http://www.interaktonline.com/Documenta ... ctions.htm

I have used multiple inserts (up to 10) on a single page and a single Insert Button adds records into all the individual tables.

1) Build master table, to be used as your header information
2) Build individual backend tables, including a foreign key that will link to the master table
3) Use Insert Form Wizard, using master table only, no redirect page
4) Now run the Insert Wizard Form again, choosing the first foreign table
5) Make the Foreign key Hidden, as well as modified/modified by
6) Delete the previous Insert Submit button, Delete the closing Form & starting Form tag (see link above)
7) Change the KT_Insert2,3,4,5,etc button values to all KT_Insert
8) Add the Link Transaction(s) to connect the Master table/form to the Foreign table(s)

antonio
Posts: 77
Joined: 2010-09-28 11:48

Re: insert form inside another insert form?

Post by antonio » 2012-04-23 08:30

perfect!
thank you very much, Fred.

tony
P.s.: it seems that we are the only two using addt/mx kollection on the planet!... :D

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: insert form inside another insert form?

Post by Fred » 2012-04-23 17:49

No it wasn't me who gave you the answer. :D

antonio
Posts: 77
Joined: 2010-09-28 11:48

Re: insert form inside another insert form?

Post by antonio » 2012-04-24 08:05

Fred wrote:No it wasn't me who gave you the answer. :D
Hi Fred,
this mean that:
- it was monday...
- we are not alone!

Ciao ;).

tony

Post Reply