O - New Version
O - Variation of Previous Version
(Where the "O"s are radio buttons)
And if they click "New version" then I need to offer a text-field called "title" and be done with it...
But if they click "Variation" then I need to offer a selection drop-down of titles from previous versions (like Old One A, Old One B, Old One C, etc) and a text field called "variation" for them to input something like "extra space" or "light color" etc.
And, obviously, I want it to do this without refreshing the page and as fluidly as possible.
<html>
<head>
<style type="text/css">
.hide {display:none}
</style>
<script type="text/javascript">
function toggle(style1,style2) {
document.getElementById("div1").style.display=style1;
document.getElementById("div2").style.display=style2;
}
</script>
</head>
<body>
<input type="radio" name="rad" onclick='toggle("block","none")'/> New Version <br>
<input type="radio" name="rad" onclick='toggle("none","block")'/> Variation of Previous Version<br>
<div class="hide" id="div1">
a div with some stuff in it
</div>
<div class="hide" id="div2">
a different div, with different stuff in it
</div>
</body>
</html>
What you need is to set rules (conditional logic) on your radio buttons field. If you prefer not coding it, I suggest you use this form generator for your job, 123ContactForm. It allows setting rules with ease, and the fields will be visible without any refresh, as it works on a JavaScript interface. You can also tweak the codes if you want, I am very content with that feature. Hope it wil work fine for you too!
Cheers, R
Bookmarks