Hello,
I hope this will be of help to you. I contracted for an outside source to do this feature for me. I will share the code here but understand, I don't know how it works so I can't answer any questions on it. I'm just happy to have my form do what I want it to.
Note: the code in the Javascript area contains two sets of code. One to do the radio group display and one to look at the current date and then put up a specific price depending on the month of the year. You'll have to change the code so you get only what you want, I expect.
The form can be found at:
www.nemgtr.org/index.php?option=com_cont...application&catid=39
I suggest you look at it first and then go from there.
Add to CSS/Javascript tab
<script type="text/javascript">
function hideCarElemenets()
{
for(i=0;i<4;i++)
for(j=1;j<=7;j++)
document.getElementById('c'+(i+1)+'h'+j).style.display = 'none';
var number = 0;
for(i=0;i<document.getElementsByName('form[CatNumber]').length;i++)
if(document.getElementById('CatNumber'+i).checked)
{
number = parseInt(document.getElementById('CatNumber'+i).value);
break;
}
//alert(number);
for(i=0;i<number;i++)
{
for(j=1;j<=7;j++)
document.getElementById('c'+(i+1)+'h'+j).style.display = '';
}
}
function monthSelection()
{
today = new Date();
currMonth = today.getMonth();
if(currMonth <= 3)
{
document.getElementById('paypal-1385').options[1].selected = true;
document.getElementById('paypal-1385').options[0].disabled = true;
document.getElementById('paypal-1385').options[2].disabled = true;
}
if(currMonth <= 11 && currMonth > 7 && currMonth > 3)
{
document.getElementById('paypal-1385').options[0].selected = true;
document.getElementById('paypal-1385').options[1].disabled = true;
document.getElementById('paypal-1385').options[2].disabled = true;
}
if(currMonth <= 7 && currMonth > 3)
{
document.getElementById('paypal-1385').options[2].selected = true;
document.getElementById('paypal-1385').options[0].disabled = true;
document.getElementById('paypal-1385').options[1].disabled = true;
}
}
window.addEvent('domready', function() {
hideCarElemenets();
monthSelection();
getPrice_51();
});
</script>
Add the following to the Additional Attributes of the radio group:
onclick="hideCarElemenets();"
This is the set up of the radio group:
1|1 Car
2|2 Cars
3|3 Cars
4|4 Cars
Hope this helps out. And maybe it will spark some more sharing of code for the forum users. I've found lots of interesting things to add to my forms by looking through the posts.
Regards,
Kathy
Web Manager,
www.nemgtr.org
This e-mail address is being protected from spambots. You need JavaScript enabled to view it