Hi,
I've a donation form with checkbox options for the amount.
I'd like to make an option in the checkbox group "other" and when it's clicked a text box appears allowing user to add a custom option.
Prob is that both inputs have to have id="amount" (mapped via the a.net plugin) to submit, which screws the whole thing up.
I tried the following. When the conditional "amount" field is filled in, the form submits correctly, but when the checkboxes "amount" field is selected, the "a valid amount is required" error is thrown
(https://www.enlightencom.com/index.php?option=com_chronoforms&chronoform=authorizenet_donation_form-Copy)
in JS on load
I tried changing the id of the one being used with the following (ie, change the id of the field being used to equal x_amount, and change the id of the one being used to something different...)
But I can't seem to change id's. I'm pretty sure this can be done in jQuery...
Would love a suggestion re how to move forward.
thanx
Mark
I've a donation form with checkbox options for the amount.
I'd like to make an option in the checkbox group "other" and when it's clicked a text box appears allowing user to add a custom option.
Prob is that both inputs have to have id="amount" (mapped via the a.net plugin) to submit, which screws the whole thing up.
I tried the following. When the conditional "amount" field is filled in, the form submits correctly, but when the checkboxes "amount" field is selected, the "a valid amount is required" error is thrown
(https://www.enlightencom.com/index.php?option=com_chronoforms&chronoform=authorizenet_donation_form-Copy)
in JS on load
var checkbox_id, textarea_id, checkbox, textarea, div;
/* edit the next two lines to match the ids of the elements in your form */
checkbox_id = 'checkbox';
textarea_id = 'amount';
window.addEvent('domready', function() {
checkbox = $(checkbox_id);
textarea = $(textarea_id);
div = $(textarea_id+'_container_div');
div.dissolve();
showHide();
checkbox.addEvent('click', showHide);
});
function showHide() {
if ( checkbox.checked ) {
div.reveal();
textarea.disabled = false;
} else {
div.dissolve();
textarea.value = '';
textarea.disabled = true;
}
}
I tried changing the id of the one being used with the following (ie, change the id of the field being used to equal x_amount, and change the id of the one being used to something different...)
amount.attr('id','differentid');
But I can't seem to change id's. I'm pretty sure this can be done in jQuery...
Would love a suggestion re how to move forward.
thanx
Mark
Hi Mark,
I'm pretty certain that the A.net action uses the input names not the IDs. So I'm not sure that you need to change the IDs.
If you have more than one input with the same name only the last one will be submitted. So I would give them different names and then add a check in a Custom Code action in the ON Submit event to set the value of $form->data['amount'] before the A,net action runs.
Bob
I'm pretty certain that the A.net action uses the input names not the IDs. So I'm not sure that you need to change the IDs.
If you have more than one input with the same name only the last one will be submitted. So I would give them different names and then add a check in a Custom Code action in the ON Submit event to set the value of $form->data['amount'] before the A,net action runs.
Bob
This topic is locked and no more replies can be posted.