Fill text box on a click of a button

Hey Rapidweaver Community,

I would like to know how to use a button group stack to enter a value into a text area upon a click? As seen on the UN website, if I click on $35 then the text area holds the value of $35, and as I click on $50 the value on the text area changes to $50.


https://give.undp.org/give/120717/#!/donation/checkout

Thanks,
Menino

It would be worth looking at 1LD’s Formula stack. That might do it.

https://onelittledesigner.com/rapidweaver-stack/formula/

Rob

Yes, this is a very useful looking stack. What I’m particularly interested in is the ability to export the values to any form. Don’t suppose you’ve tried this with Formloom?

I haven’t I’m afraid. Maybe someone else has?

I have not tested this at all but if you can add an onclick attribute to the button then try adding this code to a button…

document.querySelector('input[name=amount]').value=75

You will need the custom the name of the input from amount to whatever you are using. And obviously the value as well.

1 Like

I don’t understand what you are trying to achieve. Why not just make the amount buttons do what the form entry is doing? ie: click on the $35 button and it adds $35 to the cart? Having a button fill a form seems like an extra un-needed step to me but I’m probably missing something. For my “donations” I have buttons that will add specific amounts but I also use a form so the user can enter a different amount if they wish. But 95% of contributors use a fixed price button which directly adds the amount to the cart. Again, apologies if I’ve missed you goal.

Probably not exactly answering the question that you asked but if its of any use for you to know, I collect user information from forms in a website made with Formloom3 to Google Sheets. It works great. Here is the set up: https://yabdab.zendesk.com/hc/en-us/articles/205171855-Formloom-3-and-Google-Sheets-Setup.

I will try this method and see. Hope it works out. To clarify I am just using the foundation button group and number input stack.

Not what I was asking there but very useful to know anyway - thanks

I whipped up an example of this working using my Foundation stacks… http://sandbox.joeworkman.net

A small tweak to what I said earlier. Instead of using onclick set the URL to be this… (with the corresponding changes like I mentioned earlier.)

javascript:document.querySelector('input[name=amount]').value=50
4 Likes

Thank you Joeworkman!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.