New call-to-action
Results 1 to 9 of 9

Thread: How to reset the value of a Stripe Form

  1. #1
    Member
    Real Name
    Roman Rapido
    Join Date
    Nov 2011
    Posts
    111

    Default How to reset the value of a Stripe Form

    I created a Static Text in Alpha and asigned the value below
    <div class="stripe-form">
    <label>
    <span>Card number<font color="#eb0f0f">*</font></span>
    <div id="card-number" class="txt-field"></div>
    </label>
    <label>
    <span>Expiration - MM/YY<font color="#eb0f0f">*</font></span>
    <div id="card-exp" class="txt-field"></div>
    </label>
    <label>
    <span>CVC<font color="#eb0f0f">*</font></span>
    <div id="card-cvc" class="txt-field"></div>
    </label>
    </div>

    The code above produces a nice looking fields to accept credit card no, expiration and cvc.

    How do I reset the Values of this to blank if I click cancel? The regular Alpha Code {dialog.object}.resetForm(); doesnt do anything because the values in it are not from a textbox, its html code inside a static text in

    Thanks!

  2. #2
    Volunteer Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Lexington, KY
    Posts
    1,492

    Default Re: How to reset the value of a Stripe Form

    Have you tried
    $('{dialog.componentName.V.R1.CARD_NUMBER').innerHTML='';

    (or something close to that)?
    Use the Chrome debugger to test it in the console.

    Jay
    Jay Talbott
    Lexington, KY


  3. #3
    Member
    Real Name
    Matthew Shoemate
    Join Date
    Sep 2019
    Posts
    26

    Default Re: How to reset the value of a Stripe Form

    Try what Jay said or even document.getElementById('DLG1.V.R1.ExampleID').innerHTML = '';

  4. #4
    Volunteer Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Lexington, KY
    Posts
    1,492

    Default Re: How to reset the value of a Stripe Form

    Quote Originally Posted by Jay Talbott View Post
    Have you tried
    $('{dialog.componentName.V.R1.CARD_NUMBER').innerHTML='';

    (or something close to that)?
    Use the Chrome debugger to test it in the console.

    Jay
    Sorry, I left out a } in the line above.
    It should read:

    $('{dialog.componentName}.V.R1.CARD_NUMBER').innerHTML='';

    Sorry for any confusion.

    The DLG1 may work, as mshoemate suggests, but I believe that using the place holder {dialog.componentName} is more comprehensive.

    The Chrome developers tools will tell you the specific component name.

    Jay
    Jay Talbott
    Lexington, KY


  5. #5
    Member
    Real Name
    Roman Rapido
    Join Date
    Nov 2011
    Posts
    111

    Default Re: How to reset the value of a Stripe Form

    May I kindly request if you can copy the alpha Control below and create a new ux component and select Menu and select paste controls from the clipboard. It will show the UI with 3 input text
    Can't clear the text with this code, I replace the parameter based on my component name
    $('{dialog.componentName}.V.R1.CARD_NUMBER').innerHTML='';

  6. #6
    Member
    Real Name
    Roman Rapido
    Join Date
    Nov 2011
    Posts
    111

    Default Re: How to reset the value of a Stripe Form

    DIM page_fields[1] as P
    with page_fields[1]
    .display = "{B=White,Light Blue}{I:'vertline'}{I:'vertline'}{I:'vertline'}{Data=07033baa_0635_4fbe_95bc_a4df878df8b4}{I:'$$format.text'} [Static Text:<style> .stripe-form { font: 16px Arial...]
    Attached Files Attached Files

  7. #7
    Volunteer Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Lexington, KY
    Posts
    1,492

    Default Re: How to reset the value of a Stripe Form

    I originally assumed that you were using Alpha controls for this component. I see you are not, you are using an html form.
    So if you look at the images here, you can see that
    $('card-number').innerHTML
    is sufficient to define the control. You can clear the control with:
    $('card-number').innerHTML='';
    Why aren't you using Alpha's text controls?
    I think you are making extra work for yourself.
    addText.pngclearText.png

    Jay
    Jay Talbott
    Lexington, KY


  8. #8
    Volunteer Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Lexington, KY
    Posts
    1,492

    Default Re: How to reset the value of a Stripe Form

    And just for yucks, I added an Alpha control to your form, and here is where you would need the:
    $('{dialog.componentName}.V.R1.CARD_NUMBER').value='';
    (note it is value with an Alpha control, not innerHTML)

    alphaControl.png

    For what it is worth.
    Jay
    Jay Talbott
    Lexington, KY


  9. #9
    Member
    Real Name
    Roman Rapido
    Join Date
    Nov 2011
    Posts
    111

    Default Re: How to reset the value of a Stripe Form

    Thanks Jay, I will try it right away. The reason why i used something like this because of a stripe scenario to customize the input controls for stripe details.

    Edit:
    Awesome! It works! Thanks Jay once again!
    Last edited by doorscomputers; 02-11-2020 at 09:03 AM.

Similar Threads

  1. Stripe and Payment Intent Stripe Genie
    By Tbrondolo in forum Mobile & Browser Applications
    Replies: 0
    Last Post: 06-07-2019, 10:57 AM
  2. reset form question
    By frankbicknell in forum Mobile & Browser Applications
    Replies: 3
    Last Post: 04-20-2017, 04:22 PM
  3. How to reset reset UX-LIST client side filter ?
    By Ken Tjia in forum Mobile & Browser Applications
    Replies: 8
    Last Post: 01-27-2015, 07:33 PM
  4. Form reset?
    By pps in forum Alpha Five Version 5
    Replies: 2
    Last Post: 05-28-2004, 03:34 PM
  5. RESET FORM DISPLAY TO DEFAULT
    By ken tjia in forum Alpha Five Version 4
    Replies: 2
    Last Post: 11-17-2001, 06:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •