Jump to content
  • 0

Web Form that Updates Two Tables?


mdupras

Question

Is there no way to have a single web form write to more than one table? For this restaurant database I'm working on, I need to store certain information (hours of operation) in a separate table, but I want one input form to write to both the main table and the hours of operation table. However, it seems that's not possible. Web forms can use views, but only views that reference one table.

Any thoughts on how to work around this?

-- Mike

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi Mike,

One work around to this would be to create a two forms: form1 (linked to main table) and form2 (linked to hours of operation).

Configure form1 to go to form2 after it's submitted and pass some values from form1 to form2 using passing parameters. Automatically submit form2 using some javascript. Here is a sample code to do this. You must place it in the footer.

<script type=\"javascript/text\">
setTimeout('document.getElementById(\"caspioform\").submit()',500);
</script>
Link to comment
Share on other sites

  • 0

Thanks! Since my first post I figured out to use two forms, but I have the user filling in information on both forms. It sounds like what you're saying is they fill in all the information on the first form, and the information that needs to go in the second table is passed to the second form, which catches it all but is never seen by the user because it's auto-submitted -- is that right?

I like that idea, but here's what might be a wrinkle. In the \"hours of operation\" table, for each restaurant record in the main table, there are 7 records in the hours table -- one for each day of the week, with overall hours, when they serve breakfast, lunch, etc.

The first form passes the auto-incrementing ID to the second form, and when the second form is submitted, it reloads so the user can enter another day of the week.

I'd prefer only one form, but I'm not sure if what I'm describing would work using your method -- what do you think?

-- Mike

Link to comment
Share on other sites

  • 0

Hi @mdupras,

 

You can use triggered action to update another table upon insert to the first table. You don't have to use two web forms. 

For more information about triggered action, you can visit this link: https://howto.caspio.com/tables-and-views/triggered-actions/

You can also check this forum post to have some idea: 

 

 

Regards,

kristina

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...