Jump to content

Multiple submission base on user input

Recommended Posts

Hi all,

I'm fairly new to javascript and I'm working on this frequent buyer website. What I'm trying to do is to submit the form multiple times base on user input. 

I have this code:


document.addEventListener('BeforeFormSubmit', function (event) {
var countx = document.querySelector('[id*=Purchase_count');

for (var i=1;i < countx.value;i++) {


Is there a reason why it's not working properly in google chrome but works fine on Edge?

Here's my datapage: https://c1abc789.caspio.com/dp/3dca7000a203fdee67e14f3ebfa1

Feel free to submit some test records. 

Thanks in advance for any help I can get on this.

Share this post

Link to post
Share on other sites

Using JS to have multi submit is not a good idea specifically if you have a number of for instance 15 ~ 20 or more. Instead you can get the Purchase_count from the form and have as triggered actions based on the source table which adds info for that many times you want to repeat this in your table.

Share this post

Link to post
Share on other sites

The source of the submission is different from where you get all rows. There are 3 tables here. One is QTY which has one Integer field holding 1 to 50. Two same tables MultiSubmit and MutliSubmitDetails.


Submission is based on MultiSubmit and MutliSubmitDetails are having all rows including the initial row. 



Share this post

Link to post
Share on other sites

I totally forgot about the triggered actions! Thanks for reminding me. I'll explore into that.

Anyway, the max limit they can submit is 12 per submission. Kinda like a card they need to fill in. Once they have 12 purchases they get a free product.

Share this post

Link to post
Share on other sites

If you want the maximum submission to be just 12, then you can just set the fields inside the QTY field to 12. 

The inner join you see up there in the select will serve as the loop that while the QTY is greater than or equal to a certain value, then, continue adding the field. 

Share this post

Link to post
Share on other sites

Here is what I'm trying to do:



Right now, it's working just fine but without the Qty field. The user will have to enter the the purchases one by one.

With the Qty field, I got that working with javascript (only works in Edge for some reason). 

I tried your triggered action sample,   I think it's adding purchases depending on the number in the Qty Table? or I might've missed something.


Below is what I'm trying to do. My logic is it will add entries if the count of entries that have the same Purchase_ID is less than the  #inserted.Qty. 

I can't seem to make it work. Am I doing it wrong?


Share this post

Link to post
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.

Reply to this topic...

×   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.


  • Create New...