chriswoods Posted August 12, 2013 Report Share Posted August 12, 2013 Sorry for all the questions, I do search/read the topics and forum for help before posting! How would I use a single form submission to enter data into two different tables at the same time? For example, user adds a customer of his, which then creates an entry in the "Clients" table (because it is new), and also creates an entry in the"Sales_Coverage" table to create an association between him (Person) and that Client. It would be impractical to have a user enter this info into two different forms. Thank you in advance, Chris jonathanr and denbrian 2 Quote Link to comment Share on other sites More sharing options...
MayMusic Posted August 12, 2013 Report Share Posted August 12, 2013 You can create another DataPage based on the other table and have it as the destination after submission. Check to receive the parameters that need to be passed to this page and received them on the new page. In the second page you can have auto submit button upon page load by having this code in an HTML Block at the end of the list elements: <script> function f_submit() { document.getElementById("caspioform").submit(); } document.addEventListener('DataPageReady',f_submit); </script> After adding data to the first page, user will be redirected to the next page which will be auto submitted and user will see the successful submission message. If you would like you can hide the submit button and also the fields on the page. To hide the submit button, create a copy of the style. Check Show Advanced Options (CSS Source), navigate to setting screens and under Firms/Details >> Buttons switch to Source tab and add display:none; to .cbSubmitButton To hide elements use table tags: http://howto.caspio.com/tech-tips-and-articles/common-customizations/how-to-hide-fields-in-datapages/ NaghmehK 1 Quote Link to comment Share on other sites More sharing options...
chriswoods Posted August 13, 2013 Author Report Share Posted August 13, 2013 Thank you so much for the help! I will work on this tomorrow! Quote Link to comment Share on other sites More sharing options...
MayMusic Posted August 13, 2013 Report Share Posted August 13, 2013 Sure Quote Link to comment Share on other sites More sharing options...
chriswoods Posted August 15, 2013 Author Report Share Posted August 15, 2013 works perfectly, thanks! Quote Link to comment Share on other sites More sharing options...
MayMusic Posted August 19, 2013 Report Share Posted August 19, 2013 You are welcome Quote Link to comment Share on other sites More sharing options...
ChrisCarlson Posted May 28, 2014 Report Share Posted May 28, 2014 Hello, How do I pass an autonumber field from a submit form to another submit form? The autonumber is not listed as a field on the 1st submit form, so I cannot find where I can enable pass and receive of this field. I need to split a database into 2, due to 255+ fields and need to link the 2nd table to the 1st via the same autonumber. I am able to pass values via the virtual field to the 2nd submit form (hidden) using the script above but need to get the autonumber to bridge as well. Doesnt the autonumber generate at the time of submit, and if so how do I get it to pass to the 2nd submit form? Quote Link to comment Share on other sites More sharing options...
ChrisCarlson Posted May 28, 2014 Report Share Posted May 28, 2014 In regards to the message above, I found the checkbox where you can select to pass the autonumber, and have enabled receive of this autonumber on the 2nd submit form, however I am still unable to get the autonumber to bridge over. On the second table, I have set the field to number type, whereas the first table has it set as an autonumber field. Quote Link to comment Share on other sites More sharing options...
casGary Posted May 29, 2014 Report Share Posted May 29, 2014 Hi Ccarls3, Are you sure that you actually need to pass it? If you always submit those two forms at the same time why don't you just make another autonumber field in the second table. Quote Link to comment Share on other sites More sharing options...
casGary Posted May 29, 2014 Report Share Posted May 29, 2014 If you do need to do this, you may try to pass parameter as a query string. It is very well described in this article http://howto.caspio.com/parameters/parameters-as-query-string-values/ Quote Link to comment Share on other sites More sharing options...
danielg05 Posted January 7, 2018 Report Share Posted January 7, 2018 With regards to Chris and May, because of recent releases and the asynchronous enhancements I was receiving an error message form the bridge about the "onload" event so I think this should suffice: <script type="text/javascript"> function f_submit() { document.getElementById("caspioform").submit(); } document.addEventListener('DataPageReady',f_submit); </script> Ref: https://howto.caspio.com/deployment/?_ga=2.55701288.248583459.1515247308-2040463417.1503146327 MayMusic 1 Quote Link to comment Share on other sites More sharing options...
MayMusic Posted January 8, 2018 Report Share Posted January 8, 2018 You to check to pass AutoNumber or any Auto generated values from submission page as follow Then on the next page you can receive these values in this format: [@InsertRecordFIELDNAME] FIELDNAME is the name of the field in your table. danielg05 1 Quote Link to comment Share on other sites More sharing options...
danielg05 Posted January 8, 2018 Report Share Posted January 8, 2018 Correct, that as well thanks. Quote Link to comment Share on other sites More sharing options...
prashant121 Posted January 18, 2018 Report Share Posted January 18, 2018 thank you Quote Link to comment Share on other sites More sharing options...
MayMusic Posted January 18, 2018 Report Share Posted January 18, 2018 There all, according to https://howto.caspio.com/deployment/, when switching from legacy deployment method to asynchronous method, existing JavaScript customization code in your DataPages must be updated if it contains any of the following: If your script contains onload event similar to the one here: <script type="text/javascript"> window.onload = function() { // do something }); </script> The onload event should be replaced with Caspio built-in event as shown below: <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { // do something }); </script> You can also use event.detail.appKey or event.detail.uniqueSuffix to specify which DataPage’s loading event to execute your functions using the example below: <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { if (event.detail.appKey == 'MY_DATAPAGE _APPKEY') { //do something } else if (event.detail.appKey == 'MY_WEB_FORM_APPKEY') { //do something } }); </script> Therefore I have updated the code above Quote Link to comment Share on other sites More sharing options...
TsiBiRu Posted March 7, 2019 Report Share Posted March 7, 2019 Hello everyone, I just wanted to share something, I've tried following the recommendations in this post and initially use the code below to auto submit my second DataPage once I successfully received the value from my first DataPage <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { document.getElementById("caspioform").submit(); }); </script> But I've encountered some issue, the second DataPage will keep on submitting records until I close the tab. As a result, my table will be flooded with blank records that only contains the primary key of my Table. What I did to fix that, is the code below and attached it to an HTML block and the issue has been resolved. <script type="text/javascript"> if(document.getElementById("caspioform")) { document.getElementById("caspioform").style.display = 'none'; setTimeout('document.forms["caspioform"].submit()',1000); } </script> Regards, TsiBiRu Quote Link to comment Share on other sites More sharing options...
kpcollier Posted June 3, 2019 Report Share Posted June 3, 2019 On 3/7/2019 at 3:31 PM, TsiBiRu said: Hello everyone, I just wanted to share something, I've tried following the recommendations in this post and initially use the code below to auto submit my second DataPage once I successfully received the value from my first DataPage <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { document.getElementById("caspioform").submit(); }); </script> But I've encountered some issue, the second DataPage will keep on submitting records until I close the tab. As a result, my table will be flooded with blank records that only contains the primary key of my Table. What I did to fix that, is the code below and attached it to an HTML block and the issue has been resolved. <script type="text/javascript"> if(document.getElementById("caspioform")) { document.getElementById("caspioform").style.display = 'none'; setTimeout('document.forms["caspioform"].submit()',1000); } </script> Regards, TsiBiRu Hey @TsiBiRu, with this fix, are you just closing the form 1 second after the submit button is clicked? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.