Hello there, I wonder if anyone can help me.
Its been a few years since I last regularly used javascript and I'm a bit rusty. And I'm also having difficulty finding the right bits to change in the layouts.
On our engraving website we have engravable products. But people don't always want something engraved on their items.
So we have radio button lists, basically a choice between "Engraving Please" and "No Engraving Thankyou".
There is then a prompt box which the customer can enter what they want engraved into. However, we only want this to appear when customers select the "Engraving Please" option.
So, I have put display: none in the prompt box div tag (with an id of engravingprompt) so that it is hidden as standard, with the intention of making use of the following bit of script to reveal it and hide it again as necessary:
<script type="text/javascript" language="JavaScript"><!--
function RemoveContent(d) {
document.getElementById(d).style.display = "none";
}
function InsertContent(d) {
document.getElementById(d).style.display = "";
}
//--></script>
The idea then is to use an onClick event handler so that when someone selects either of the radio buttons it reads what the choice says and decides from that whether it should reveal or hide the prompt box and does so, thus:
if (<actinic:variable name="ChoiceDisplayLabel" /> = 'Engraving Please')
{
InsertContent('engravingprompt');
}
else
{
RemoveContent('engravingprompt');
}
Now, where would I *put* the onClick event, I cannot find which layout to put it in? Also, am I being stupid and missing a simpler way of doing all this? Will this even work? Is "ChoiceDisplayLabel" actually the right variable that I need?
Why are we even bothering you may ask. Well, this is a cut down situation, when I've got this bit figured out I can easily expand it. We actually need several different options and things to turn up and disappear as people select them.
Its been a few years since I last regularly used javascript and I'm a bit rusty. And I'm also having difficulty finding the right bits to change in the layouts.
On our engraving website we have engravable products. But people don't always want something engraved on their items.
So we have radio button lists, basically a choice between "Engraving Please" and "No Engraving Thankyou".
There is then a prompt box which the customer can enter what they want engraved into. However, we only want this to appear when customers select the "Engraving Please" option.
So, I have put display: none in the prompt box div tag (with an id of engravingprompt) so that it is hidden as standard, with the intention of making use of the following bit of script to reveal it and hide it again as necessary:
<script type="text/javascript" language="JavaScript"><!--
function RemoveContent(d) {
document.getElementById(d).style.display = "none";
}
function InsertContent(d) {
document.getElementById(d).style.display = "";
}
//--></script>
The idea then is to use an onClick event handler so that when someone selects either of the radio buttons it reads what the choice says and decides from that whether it should reveal or hide the prompt box and does so, thus:
if (<actinic:variable name="ChoiceDisplayLabel" /> = 'Engraving Please')
{
InsertContent('engravingprompt');
}
else
{
RemoveContent('engravingprompt');
}
Now, where would I *put* the onClick event, I cannot find which layout to put it in? Also, am I being stupid and missing a simpler way of doing all this? Will this even work? Is "ChoiceDisplayLabel" actually the right variable that I need?
Why are we even bothering you may ask. Well, this is a cut down situation, when I've got this bit figured out I can easily expand it. We actually need several different options and things to turn up and disappear as people select them.
Comment