Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Help with submitting a form using JavaScript when Stripe gives its response

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with submitting a form using JavaScript when Stripe gives its response

    I am working on a Stripe integration using Curl and JavaScript. It is working, and I receive a confirmation from Stripe. Then I want to use JavaScript to submit the UX, probably by simulating clicking the submit button. However, this is not working yet. I am not sure of the ID of the button for JavaScript purposes, or if it will be clicked successfully from the JavaScript.
    Here is the JavaScript I am trying:
    Code:
    document.getElementById("CUST_INFOUX3.V.R1.BUTTON_SUBMIT").click;
    Richard Urban

    Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

  • #2
    You don't need the button, you just need to run the Javascript that runs when the button is clicked ( you can copy that out of the button) when you receive the confirmation from stripe.
    Insanity: doing the same thing over and over again and expecting different results.
    Albert Einstein, (attributed)
    US (German-born) physicist (1879 - 1955)

    Comment


    • #3
      It will look like this if its a List control


      setTimeout(function(){
      var lObj = {dialog.object}.getControl('ORDERS');


      if(lObj.selection[0] != 'undefined') {
      lObj._selectedRow = lObj.selection[0];
      }

      lObj.updateListFromUXControls();
      }, 1000);
      Insanity: doing the same thing over and over again and expecting different results.
      Albert Einstein, (attributed)
      US (German-born) physicist (1879 - 1955)

      Comment


      • #4
        I am submitting a UX. The button now says
        Code:
        {dialog.object}.submit()
        But that will not work by itself. I think it needs to be formatted something like you have for the list control. I am using an older version of Alpha, 2682 Build 4435.
        Richard Urban

        Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

        Comment


        • #5
          Here is the result when I just insert the above in the JavaScript file. stripedev1.png
          Attached Files
          Richard Urban

          Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

          Comment


          • #6
            This is the correct code, that is now working, to submit the UX form after the Stripe confirmation:
            Code:
            document.getElementById("CUST_INFOUX3.V.R1.BUTTON_SUBMIT").click();
            There must have been some other problem when I tried it above and it did not work.

            Code:
            // Calls stripe.confirmCardPayment
            // If the card requires authentication Stripe shows a pop-up modal to
            // prompt the user to enter authentication details without leaving your page.
            var payWithCard = (stripe, card, clientSecret) => {
            loading(true);
            stripe.confirmCardPayment(clientSecret, {
            payment_method: {
            card: card
            }
            })
            .then((result) => {
            if (result.error) {
            // Show error to your customer
            showError(result.error.message);
            } else {
            // The payment succeeded!
            orderComplete();
            // Click on the button and submit the form
            document.getElementById("CUST_INFOUX3.V.R1.BUTTON_SUBMIT").click();
            }
            });
            };
            Here is the button name to look for in the development console in your browser. This is not the button name that is stated in the UX, which is simply "BUTTON_SUBMIT"
            Also, it is not the button image name, but the button name is in the div id:
            stripedev3.png
            Last edited by richardurban; 01-03-2021, 09:14 PM.
            Richard Urban

            Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

            Comment


            • #7
              Your ordercomplete() function should process what you want and you shouldn't need to tell the browser to acttivate an onclick event. Some user browsers can have issues with this depending on their browser security settings (although most would be ok). I'm with Pete on this, thinking you don't need the extra click event when you aready have a response from Stripe and you are calling a function based on that response.

              Comment


              • #8
                OK. So for a UX to submit the UX, what is the javaccript to use?
                Richard Urban

                Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

                Comment


                • #9
                  Richard, being that you're on a six year old version of Alpha it's going to be really hard for anyone here to help. It's important to lead with that in your post so whomever takes up your question knows the limitations of your IDE. That said ...


                  Your post #4 is the correct JavaScript for initiating the saving of data in a data bound UX. You should have additional code (Action Scripting > Save Submitted Data to Tables) in your afterDialogValidate server-side event that handles the server-side of saving data. In Pete's post #3 that would be the code for a list control with detail view.

                  Are you using a list control? You mention a list in one of your posts. Is it using the lists' detail-view function? If there is no detail view function then is your UX data bound? You said you're using CURL and it's working. Inside that xbasic function you already have all the data because you submitted it, via a CURL function, to Stripe. You're wanting a submit button so I assume you're wanting to save data to a SQL table, right? You can do that right inside that xbasic function and then give the user a message that the data was saved.

                  That's about the best I can do with out a lot more info. I hope that helps.
                  Mike Brown - Contact Me
                  Programmatic Technologies, LLC
                  Programmatic-Technologies.com
                  Independent Developer & Consultant

                  Comment


                  • #10
                    I decided to separate the form (UX) submission for customer information from the Stripe Payment form that is part of the Stripe Elements environment. The button would not click on mobile devices, only on desktop.

                    With the newer configuration, when the form is submitted, then the result page is a page with the Stripe credit card form on it, or actually a UX that includes the form in a free form container. Then, after the customer fills out the card information and submits it, when the Stripe system responds, a confirmation page is called from the javascript file with window.location.replace. A field in my application is filled in as paid by the confirmation page, too.

                    It may not be the most graceful methodology, but it works, and it only used vanilla Javascript and xbasic. That is compatible with older versions of Alpha like mine; Version 12.3 build 2682. It also works with the most recent version of Stripe Payment Intents.
                    Richard Urban

                    Grocery Delivery Software for Stores and Entrepreneurs: http://www.urbangrocery.com

                    Comment

                    Working...
                    X