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:

<SCRIPT>

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

for (var i=1;i < countx.value;i++) {
document.getElementById("caspioform").submit();
}
})
</SCRIPT>

 

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.

Link to comment
Share on other sites

Here is what I'm trying to do:

image.thumb.png.7db5c183a4cdc70511ad9561b2f55444.png

 

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?

image.thumb.png.14c0dc9a96a7f6ea84a3e80e4aee887b.png

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

Loading...
 Share

×
×
  • Create New...