sigil88
4/26/2017 - 1:39 PM

joomla rsforms pro - use js to autofill a text input based on a select option choice. NOTE!!! This doesn't pull through to the admin email.

joomla rsforms pro - use js to autofill a text input based on a select option choice. NOTE!!! This doesn't pull through to the admin email.



<script>
jQuery(document).ready(function($) {
	$('#AssessmentType_DropdownChoice_S4D').click(function() {
		if($('#AssessmentType_DropdownChoice_S4D option').is(':selected') && $('#AssessmentType_DropdownChoice_S4D option:selected').val().length > 0) {
			var $s4dPrice  = $('#AssessmentType_DropdownChoice_S4D').find(':selected').text();
			$('#Amount_Invoice_S4D').attr('value',$s4dPrice);
			$('#Amount_Invoice_S4D').attr('disabled','disabled');
		}
		else {
			return false;
		}
	});

	$('#AssessmentType_DropdownChoice_FM').click(function() {
		if($('#AssessmentType_DropdownChoice_FM option').is(':selected') && $('#AssessmentType_DropdownChoice_FM option:selected').val().length > 0) {
			var $fmPrice  = $('#AssessmentType_DropdownChoice_FM').find(':selected').text();
			$('#Amount_Invoice_FM_AC').attr('value',$fmPrice);
			$('#Amount_Invoice_FM_AC').attr('disabled','disabled');
		}
		else {
			return false;
		}
	});

	$('#AssessmentType_DropdownChoice_AC').click(function() {
		if($('#AssessmentType_DropdownChoice_AC option').is(':selected') && $('#AssessmentType_DropdownChoice_AC option:selected').val().length > 0) {
			var $fmPrice  = $('#AssessmentType_DropdownChoice_AC').find(':selected').text();
			$('#Amount_Invoice_FM_AC').attr('value',$fmPrice);
			$('#Amount_Invoice_FM_AC').attr('disabled','disabled');
		}
		else {
			return false;
		}
	});
});
</script>