JavaScript How to make textbox mandatory for certain radio buttons using jQuery? make textbox mandatory html,make textbox mandatory asp.net,make

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 - TestClient and TestServer.

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.

Answer:1

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.

Answer:2

I have implemented zoom in Raphael using the setViewBox() technique. When I keep zooming the view box becomes bigger than the paper canvas size and the elements on the diagram are no longer visible. ...

I have implemented zoom in Raphael using the setViewBox() technique. When I keep zooming the view box becomes bigger than the paper canvas size and the elements on the diagram are no longer visible. ...

Trying to find a way to inline the creation of an array of data given its size, i tried var n = 4; var data = (new Array(n)).map(function(x) { return 1 }); which gave me [undefined, undefined, ...

Trying to find a way to inline the creation of an array of data given its size, i tried var n = 4; var data = (new Array(n)).map(function(x) { return 1 }); which gave me [undefined, undefined, ...

I have question regarding form submit. I have this simple form on processFabrication.php to submit all the variables then process it to the database in another page called processExceededQty.php Co, ...

I have question regarding form submit. I have this simple form on processFabrication.php to submit all the variables then process it to the database in another page called processExceededQty.php Co, ...

  1. form submit without refresh
  2. form submit without redirect
  3. form submit without button
  4. form submit without action
  5. form submit without reload
  6. form submit without refresh react
  7. form submit without javascript
  8. form submit without page refresh
  9. form submit without refresh in php
  10. form submit without refresh jquery
  11. form submit without input
  12. form submit without page refreshing- jquery/php
  13. form submit without page refresh php
  14. form submit without reload page
  15. form submit without query string
  16. form submit without url encoding

I am trying to generate a username by using the slice method. I am trying to use the users First name and last name to generate a username. Can't seem to make it work. Where am I going wrong? <...

I am trying to generate a username by using the slice method. I am trying to use the users First name and last name to generate a username. Can't seem to make it work. Where am I going wrong? <...

  1. generate bearer token using username and password