1

I have a submit button, created from - basically when this is clicked I want a groupbox to appear below where the submit button is....any suggestions?

I've tried to get the request given of from this click however it doesn't help me. I thought the logic would be similar to this:

<form>
   <input type="checkbox" name="group" value="Yes" />Yes
   <input type="checkbox" name="group" value="No" /> No
   <input type="submit" value="submit" />
</form>
<%
   String[] select = request.getParameterValues("group");
  /* Add code creation here */
%>

Any suggestions or examples you can think of?

Thanks greatly, U.

Sandman
  • 9,610
  • 8
  • 36
  • 41
urema
  • 721
  • 4
  • 11
  • 22

1 Answers1

2

First replace the checkboxes by radio buttons. Right now it's possible to check both Yes and No. This makes no sense.

<form>
   <input type="radio" name="group" value="Yes" /> Yes
   <input type="radio" name="group" value="No" /> No
   <input type="submit" value="submit" />
</form>

Then, use JSTL <c:if> tag to conditionally display content depending on parameters and/or other scoped variables in EL.

<c:if test="${param.group == 'Yes'}">
    <p>Write here HTML code which you'd like to show when 'Yes' is chosen.</p>
</c:if>
<c:if test="${param.group == 'No'}">
    <p>Write here HTML code which you'd like to show when 'No' is chosen.</p>
</c:if>
Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I get '"test" does not support runtime environments' from using the above code. – urema May 10 '11 at 21:05
  • It's "runtime expressions" :) Please click the JSTL link in the answer and follow instructions "Help! The expression language doesn't work!". I.e. ensure that you have the right JSTL version for your target runtime and that your `web.xml` root declaration is correct. By the way, did the `` work for you or not as per [my answer on your previous question](http://stackoverflow.com/questions/5911201/java-populating-option-dropdown-list/5911308#5911308)? – BalusC May 10 '11 at 21:07
  • Sorry mate, 'expressions' not 'environments' - spending to much time working with AMazon AWS! – urema May 10 '11 at 21:32
  • And yes it works I apologise - and your previous post worked as thanks greatly! – urema May 10 '11 at 21:33