Gravity form Change value of quantity based on previous field selection
Gravity form Change value of quantity based on previous field selection
Hi I am using Gravity Form, and I am trying to build a form where depending on the service you choose, the quantity of hours will update automatically. For example:
Multiple choice field: 1. Wash a car 2. wash a truck 3. wash a motorbike
Quantity field should pre-populate with either; 1 (if motorbike is selected, or 2 (if car is selected or 3 (if truck is selected)
Any help is much appreciated
1 Answer
1
A generous developer I know helped me out. Add this code after the form. here is the answer:
<script type="text/javascript">
var helpSelect = document.querySelector('#input_2_22')
var quantityInput = document.querySelector('#input_2_28')
helpSelect.addEventListener('change', function (e) {
quantityInput.value = e.target.value
})
</script>
Remember to change the input id to the id of the input in your form.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.