Click to See Complete Forum and Search --> : Radio onClick


RJ2003
04-28-2003, 05:44 AM
I've got 2 radio buttons in the form. By default, one of them is checked when the jsp is first displayed.
But if the user selects the other radio button, I want my jsp to reload so that I can do some logic in my jsp, for example, if he selects the other radio button (and not yet pressed "Save" button at the end of the form), the jsp immediately reloads itself and I update the boolean value in mt db table, reflecting his selection change of the radio button.

khalidali63
04-28-2003, 07:24 AM
in the onclick event of the radio button use this line of code
onclick="window.location.reload();"

RJ2003
04-28-2003, 07:59 AM
Thanks Khalid,

How should I retireve the value of the new selected radio button ?

I have 2 radio buttons :

<input name="listBookies" type=radio value=allBB onclick="window.location.reload()">

<input name="listBookies" type=radio value=allBB onclick="window.location.reload()">

If I do this and at the start of my jsp I retrieve by doing request.getParameter("listBookies"), I always get NULL.

What I want is, if a user selects one of the radio buttons, the jsp reloads, i extract the value of the new chosen radio button (and update my db) and present the data depending upon his selection.

RJ2003
04-28-2003, 08:00 AM
oops...sorry the radio definition was wrongly defined....it should be :

<input name="listBookies" type=radio value=allBB onclick="window.location.reload()">

<input name="listBookies" type=radio value=myOwn onclick="window.location.reload()">


Their values, of course, are different.

khalidali63
04-28-2003, 08:03 AM
you do not want reload..you want to submit the form....to do that

document.formname.submit()

and in the form elements action attribute point to your curent jsp page

<form action="surrent.jsp" method="post">

RJ2003
04-28-2003, 08:11 AM
Thanks Khalid....works !

khalidali63
04-28-2003, 08:11 AM
:D
You are most welcome...