Hello and thank you for any help you can give me. I'm using a php billing script that allows me to create order forms. Because it is scripted, I am limited in the controls I have on form fields and javascript functions. However, the author was kind enough to provide areas in which we can enter html attributes, pre-field and post-field html boxes, and a "javascript" code box that we can enter stuff into that will show up in between the <head> and </head> tags of the order page.
I am managing a site for a not-for-profit organization that accepts "sponsorships" from its members. Those who give a $25 or $50 sponsorship amount will receive mention on the sponsor page, and those who give $100 or $200 amounts are eligible to buy discounted ad banner rotations on the site. Here's what I have done so far.
On my order page I have created the select list for sponsorship levels. The "value" of each level is the dollar amount of that level. So there's a value of 25, a value of 50, a value of 100 and a value of 200 respective of each sponorship level. I then created a second select list for rotating banner ads. Now I want to provide some control.
If a person selects the $25 or $50 level, I want the second select list to be grayed out. If a person selects the $100 or $200 level, I want the second select list to be available. The original programmer of this billing script provided me with the following instructions:
Code:
Suppose you have a selectbox field called field1 attached to a product. You want that product to be a prerequisite for allowing a 2nd product to be ordered. The 2nd product is associated with another selectbox on the form, called field2.
On field2's HTML attributes, enter the following:
disabled="disabled"
That will cause field2 to be greyed out by default (it is up to the browser how a disabled control is displayed - some don't grey things out, just make them inoperable). Now to enable field2 when field1 is checked:
On field1's HTML attributes, enter the following:
onclick="field1_click();"
On the 'advanced' tab of the form, enter the following in the 'Javascript Functions' area:
function field1_click()
{
if (order_form.field1.options[order_form.field1.selectedIndex].value >= 100)
{
order_form.field2.disabled = false;
}
else
{
order_form.field2.selectedIndex = -1;
order_form.field2.disabled = true;
}
}
Unfortunately this isn't working. I'm wondering if anybody sees some kind of glaring error here that can help figure this thing out?
Thanks again for any help anybody can provide...
Schelly