Refresh display field

Refresh display field

Postby mobilemcclintic » Thu Dec 15, 2016 1:52 am

Hello,
I am just now exploring javascript and events (Exciting for me and my users), and I have started adding functions that change fields depending on selections as they are done instead of running After Save queries.
I have a dropdown box that a user selects Yes, No or Pending with the dropdown field using "|Pending|1|Yes|0|No".
This dropdown has an onchange event on it that changes a date field, which works great.
I also have a display field somewhere else on the form that shows P, Y, N depending on what is saved for the record. I am using this code "select if('#slstoquote#' = '1','Y',if('#slstoquote#' = '0','N','P'))"
I am wondering if there is a javascript code that will force an update on the display field so when a user changes the dropdown box, not only does the date field populate, but the display field updates as well.

Love nubuilder by the way. Except, every time I learn something new that is more efficient, I get to go through and recode/migrate everything...which I suppose is good experience for other projects and also gives me better arguments to rip apart another access database ;)
mobilemcclintic
 
Posts: 54
Joined: Fri Oct 23, 2015 8:04 am

Re: Refresh display field

Postby mobilemcclintic » Thu Dec 15, 2016 4:17 am

Probably not the best way, but since I only had 3 static options in this particular display field, I added
$('#dispQYN').val('N').change();

to my function to get my result to show in the display field onchange of the real field's dropdown.
mobilemcclintic
 
Posts: 54
Joined: Fri Oct 23, 2015 8:04 am

Re: Refresh display field

Postby admin » Tue Jan 24, 2017 11:25 am

mobilemcclintic,

I'm not sure I understand your question...

If you have a field called invoice_total

you can update it with $('#invoice_total').val(123.45);

(But you knew that).

Steven
admin
Site Admin
 
Posts: 3079
Joined: Mon Jun 15, 2009 9:53 am


Return to Custom Code



cron