Setting another element onchange

hcharris 08 Aug, 2018
This should be a simple problem but I'm not finding the answer on my own. I'm running chronoforms5 on Joomla 3.8.11 . I have a simple form that is getting two fields from the _users database and displaying them on the form correctly. I also have two other fields on the form: a drop-down where one selects a 1, 2, or 3 and a total field. What I want to happen is if a 1 is selected the total field value is changed to 25.00, if a 2 is selected the total field value is changed to 50.00, and if a 3 is selected the total field value is changed to 75.00. The total field is not shown (parent hidden) until the numeric field is selected.

I think I should be able to set the value in the event tab of the total field but so far I have not had any success.

Any assistance would be appreciated.

Setting another element onchange image 1
hcharris 08 Aug, 2018
Update:
I did not understand and have taken a different route.

1. Added a Load Javascript in Setup: function settotal() {this.form.elements["total"].value = '25.00'; }
2. In Designer, I have added the following in Events tab:
Setting another element onchange image 2
3. A test of the form, gives me the following html:
<script type="text/javascript">function settotal() {this.form.elements["total"].value = '25.00';
}</script>
and
function chronoforms_fields_events(){$("[name='dropdown9']").on("change", function(){if($("[name='dropdown9']").val() == "1"){if($("#fin-total, #total").closest(".gcore-subinput-container").length > 0){ $("#fin-total, #total").closest(".gcore-subinput-container").css("display", ""); }else if($("#fin-total, #total").closest(".gcore-form-row").length > 0){ $("#fin-total, #total").closest(".gcore-form-row").css("display", ""); }}}); $(':input[name="dropdown9"]').on('change', function(){ settotal()($(this)); });}

I think this is progress but the field value is not being updated when the field in the dropdown changes.

Again, I appreciate any help.
hcharris 09 Aug, 2018
Answer
After several hours of trying , I was able to get this working.
This topic is locked and no more replies can be posted.