I am working with JSP and I have a HTML form in which I have a button at the top which is Process button. Now if I click on that Process button, it shows me a form which has two radio button -
It also has
Submit button in that form.
Here is my JSFiddle.
Now what I am trying to do is - As soon as I click on
TestClient radio button, I need to type in
firstName textbox and
lastName textbox before pressing Submit button. Meaning these two textbox are mandatory for
TestClient radio button and if somebody has typed in third textbox for
TestClient radio button, then it should show error message next to that textbox. But If I am clicking
TestServer radio button, all the three textbox are mandatory, meaning I need to type in something in all the three textbox.
May be, I can use disable Submit button feature as well if certain conditions are not met along with the proper message next to the textbox?
I am new to jQuery so still learning.
I think the best thing to do here to avoid confusing your users would be to
hide() the unnecessary field like this. When the
TestClient button is selected, the
address field is hidden, but when the
TestServer button is selected, it is shown. This avoids confusion with which boxes to fill in: people tend to dislike error messages, even if they are phrased kindly.