Sorry if this has been answered already, but I could not find it in the forum:
I have a working HTML form that I've moved into ChronoForms, and have one problem. The form uses a javascript function to populate several variables based on one user choice. It's a membership: if the user chooses a certain membership type, we populate the membership type code, membership type name, and the cost of the membership. For example, if the user chooses "basic membership," we populate a type code like "0001", a type name of "basic", and the cost ($30). All of these variables end up being passed to the payment processor.
The form uses radio buttons for the membership choice.
In the existing HTML form (not in ChronoForms), we do the following:
At the top of the HTML page, we define the function GetSelectedItem() like this:
<script language="javascript">
function GetSelectedItem() {
chosen = ""
len = document.membership.os0.length
for (i = 0; i <len; i++) {
if (document.membership.os0[i].checked) {
chosen = document.membership.os0[i].value
}
}
if (chosen == "individual") {
document.membership.amount.value = 30.00;
document.membership.item_number.value = 1234;
document.membership.item_name.value = "Basic Individual";
}
....etc. (IF statements for several different membership types)
The in the form, we call the function when the button is clicked like this:
<button name="submit" value="submit" type="submit" border="0" onClick =GetSelectedItem() width="87" height="23">Join Us!</button>
The question is how to translate this functionality to ChronoForms. I put the form (including the button definition above and removing the "form" tags) in the Form Code/Form HTML area, and put the javascript function definition (removing the script tags) in the Form Code /Form JavaScript area. I've tried a couple of different combinations in the General / Form Tag Attachment field, e.g., "onClick=GetSelectedItem()" and "onSubmit=GetSelectedItem()" but don't really know what exactly should go there.
The problem is that in ChronoForms, the form works but the function never gets called. I can see that ChronoForms is picking up the correct radio button choice, but the content of the variables does not change.
I'm not really knowledgeable about javascript or PHP (someone else coded the JS function for us), so very explicit directions would be most appreciated!
I can send all of the function and form code if needed.
Thanks!
I have a working HTML form that I've moved into ChronoForms, and have one problem. The form uses a javascript function to populate several variables based on one user choice. It's a membership: if the user chooses a certain membership type, we populate the membership type code, membership type name, and the cost of the membership. For example, if the user chooses "basic membership," we populate a type code like "0001", a type name of "basic", and the cost ($30). All of these variables end up being passed to the payment processor.
The form uses radio buttons for the membership choice.
In the existing HTML form (not in ChronoForms), we do the following:
At the top of the HTML page, we define the function GetSelectedItem() like this:
<script language="javascript">
function GetSelectedItem() {
chosen = ""
len = document.membership.os0.length
for (i = 0; i <len; i++) {
if (document.membership.os0[i].checked) {
chosen = document.membership.os0[i].value
}
}
if (chosen == "individual") {
document.membership.amount.value = 30.00;
document.membership.item_number.value = 1234;
document.membership.item_name.value = "Basic Individual";
}
....etc. (IF statements for several different membership types)
The in the form, we call the function when the button is clicked like this:
<button name="submit" value="submit" type="submit" border="0" onClick =GetSelectedItem() width="87" height="23">Join Us!</button>
The question is how to translate this functionality to ChronoForms. I put the form (including the button definition above and removing the "form" tags) in the Form Code/Form HTML area, and put the javascript function definition (removing the script tags) in the Form Code /Form JavaScript area. I've tried a couple of different combinations in the General / Form Tag Attachment field, e.g., "onClick=GetSelectedItem()" and "onSubmit=GetSelectedItem()" but don't really know what exactly should go there.
The problem is that in ChronoForms, the form works but the function never gets called. I can see that ChronoForms is picking up the correct radio button choice, but the content of the variables does not change.
I'm not really knowledgeable about javascript or PHP (someone else coded the JS function for us), so very explicit directions would be most appreciated!
I can send all of the function and form code if needed.
Thanks!