You are viewing limited content. For full access, please sign in.

Discussion

Discussion

Radio Button automatically select from Drop Down

posted on December 7, 2017

Hi, 

I have a form with multiple Radio Buttons and Check boxes. The customer wants the ability to amend the form after it is submitted. Each form has a value assigned to it which is unique so i will store all the information in SQL and then on the form have a drop down to select the number then populate all the fields. I am having difficulty getting around populating the Radio Buttons and Check boxes from values. 

 

The Technical Design Number is the selection of numbers from a drop down, this will be the trigger for the rest of the forms. TYP is the value which is stored in SQL "New Customer" or "Existing Customer" css HiddenField. Type of customer is the Radio Button i want to automatically populate, it's css is RadioBtn. 

 

I have read a few posts on answers and tried, but could not manage to get it right. Could anyone see what i am missing in my code below please?

 

$(document).ready(function(){
	$('.HiddenField input').on('change',function(){
		
      var rbt = $('.HiddenField input').val($(this).val());
      
      $('.RadioBtn input:checked').val(rbt);
	});
});

 

0 0
replied on December 7, 2017

Hi Gert,

 

When configuring the radio button, have the options been given corresponding values?

 

Regards,

Sheldon

0 0
replied on December 7, 2017

Hi Sheldon,

 

Yes, i have assigned field values to the radio buttons. The values are the same as the name.

 

Regards,

Gert

0 0
replied on December 7, 2017
 $(document).ready(function () {
	$('.srbtn').on('change', 'select', RadBtn);

     RadBtn();
}); 
      
	  
  //This function will check the radio button
	function RadBtn()
	{
	  var Rbt = $('.HiddenField input').val();
          	  
	 
	  if(Rbt == 'New Customer')
	  {
		document.getElementById('Field9-1').checked = true;
	  }
      
	  if(Rbt == 'Existing Customer')
	  {
		
		document.getElementById('Field9-0').checked = true;
	  }
      
	  	  
	}//end 

This works for me

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.