No changes to the form are required (other than removing the onclick handler):
Plain JS:
Demo here
window.onload=function() { var rads = document.getElementsByName("ar_type"); for (var i=0,n=rads.length;i<n;i++) { rads[i].onclick=function() { this.form.ar_text.value=["","first_txt","second_txt","third_txt","fourth_txt","fifth_txt"][this.value]; } if (rads[i].checked) rads[i].click();
JQuery
Demo
$(document).ready(function() { $('input[name=ar_type]:radio').click(function() { this.form.ar_text.value=["","first_txt","second_txt","third_txt","fourth_txt","fifth_txt"][this.value]; }); $('input[name=ar_type]:radio').filter(":checked").click();
source share