Empty Master Detail Form with multiple DetailForms

Hi there,

I am having trouble with joining multiple forms.

I want to use multiple forms and join them as one form. There is 1 MasterForm and for example 3 Detail Forms.

Using Blocks for my setup:

MasterForm (single dataset/vertical)
DetailForm1 (single dataset/vertical)
DetailForm2 (single dataset/vertical)
DetailForm3 (multiple dataset using editable grid view/horizontal)

And this is what I want:

  1. How can I start my Form with no entry at all?
    When I remove previous and next buttons he needs the tables key id of my MasterForm, when I keep those buttons I get all datasets that are already in table. I can set tables field for Master “read only” but not for DetailForms.

  2. How can I set autoincrement for my key in DetailForm when I use a “single dataset” form instead of “editable grid view” for this detail? When I start a new entry detail gets no key id at all. The autoincrement for numbers works only for editable grid view.

I simply want my costumer to hit a button “New Entry” on my page, then redirect him to my empty MasterForm with multiple DetailForms (vertical and only for 1 record or horizontal for multiple records) that appear after entering data for Master…when he’s done editing everything there is a button “Write in Database”…he get’s ask if he really wants to write those data in database or if he wants to edit again…

User says->no…he gets back to his Form and can edit it…

User says->yes…he gets message:“Done”…then returns to my homepage…

I just need some hints because I am lost on this and I haven’t found any good tutorials on this.

Edit: I finally found a hint by chance: Sample Apps in Scriptcase…look for Form_Applications->AJAX->form53 (Orders and Items (1 - N) with AJAX routines)

Using Global Var to pass on key id of first form to the other forms…

Re: Empty Master Detail Form with multiple DetailForms

Now, I made the magic happen. But I finally have problems to solve before I can finish my work:

This is what I have:

MasterForm (single record/vertical/linked to next application/Button: insert/Global Var [var_event_id] passed on to all Forms)
event_id -> key

Form1 (single record/vertical/linked to next application/Button: insert, update)
event_venue_id -> key
event_id (comes from Global Var)

Form2 (single record/vertical/linked to next application/Button: insert, update, back)
event_host_id -> key
event_id (comes from Global Var)

Form3 (single record/vertical/linked back to homepage/Button: insert, update, back)
event_organizer_id -> key
event_id (comes from Global Var)

Right now I can only switch back and forth between Form1 -> Form3. When I hit the back button, I can Update previous page or hit new to create a new record with new id.

  1. How can get rid of the new button or make it delet the current record before adding a new one? I don’t want to give my guest possibility to create more then 1 specific event_host_id that belongs to my event_id. Actually he should delet the current record when you hit new and then create a new record. How?

  2. How can I post a max number for records that you are allowed to add for a grid view?

  3. When I insert all data for Form1 -> Form3 and I switch back from Form3 -> Form1 and update Form1, data on my other Forms are lost. Well, not lost…they are still in MySQL but he starts new records for Form2 and Form3 as he goes on again. How can I call all records that belong to my current event_id (call all records that are already recorded)?

What I have tried on Form2…Select statement for field event_host_id

SELECT event_host_id, event_id
FROM event_host_table
WHERE event_id = [var_event_id]

I thought this would work…but does not! Please help me :slight_smile:

Re: Empty Master Detail Form with multiple DetailForms

I solved my 3 problem…I needed to add the previous and next buttons so he actually runs the SQL statement “WHERE event_id = [var_event_id]”…now he picks the record if there already exists a record…2 more to go…I am working on it

I also solved problem 1…Event->OnInit

if (sc_btn_new)
{
$delet = mysql_query(“DELETE FROM cms_event_organizer WHERE event_id = ‘[var_event_id]’”);
}

Edit: I came up with an even better solution…I chanced the label NEW to NEXT and added OnInit

if (sc_btn_new)
{
sc_redir(next_application.php);
}

This way guest can eather update existing record or go on to next record…with DELET button you can delet all records that were made for specific event_id…GREAT…I love it :slight_smile:

1 Like