Dear all,
With the HTML code below the text field "Enter more information for Choice 1" displays when the checkbox "Choice 1" is checked.
For my application with PHPRUNNER 5.2 I would like to get the same result with my "Add Form".
Please explain me how can I adapt this HTML code (including the javascript)
Best regard
Pierre
**
This is my code:
<body>
<form method="post" action="">
<label for="name">Name</label> : <input type="text" name="name" id="name" /><br /> <p>
<script type="text/javascript">
function choiceClic(el)
{
var elchoice = el.form.elements['choice'], choice = null;
for(var i=0; i<elchoice.length; i++)
{
if(elchoice[i].checked) choice = elchoice[i].value;
}
document.getElementById('block1').style.display = (choice == 'ant') ? 'block' : 'none';
document.getElementById('block2').style.display = (choice == 'mod') ? 'block' : 'none';
}
</script>
<input type="checkbox" name="choice" value="ant" id="ant" onclick="choiceClic(this)" />
<label for="ant">Choice 1 </label>
<p name="block1" id="block1" style="display: none;">
<label for="morechoice1"> Enter more information for Choice 1</label> : <input type="text" name="morechoice1" id="morechoice1" /> </p>
<input type="checkbox" name="choice" value="mod" id="mod" onclick="choiceClic(this)" /><label for="mod">Choice 2 </label>
<p name="block2" id="block2" style="display: none;">
<label for="morechoice2">Enter more information for Choice 2</label> : <input type="text" name="morechoice2" id="morechoice2" />
</form>
</body>