Repopulate field with values after save

I have radio button {allyrs} with a Yes and No. Option. Initial value is Yes. It controls two fields: min year and max year. If clicked YES I populate with 2005 for min year and max is a lookup of max year in a table. The lookup is in Event application init and the same code is in ajax event ON CLICK for the radio. If they go to NO on the radio, it clears min year and max year, click Yes and it repopulates. All that works. After a save, YES for {allyrs} is still clicked which is correct, but min year and max year are blank. I need them repopulated automatically because some other lookups depend on those values being there.

I can click YES and have it repopulate, but no matter what code I put in, min year and max year are blank after a save. I can’t think of what else to try. Initial default values only work at first load. Is there something simple (obviously!) I’m overlooking?

It’s hard to answer you without looking at your code, but to be safe you can reload the data for min and max value in onBeforeUpdate and onBeforeInsert

Here is the onapplicationinit:
sc_lookup(rs,“select max(year) from vindecode”);

{allyr} is the radiobutton. This works fine for initial screen. Then I populate the rest of the form, save, and go back to the screen and {fromyear} and {thruyear} are both blank. I want them to always show 2005 and whatever ‘[bigyr]’ is after a save when it shows the screen again. Not sure beforeinsert would do that, but glad to try!

Beforeinsert wasn’t the trick. I put this same code in validatesuccess, in refresh, in scriptinit. Doesn’t work in any. Will have to go about it a different way I think.

Your data will be erase in onLoad, also onApplicationInit is run only one time, the first time the application is loaded

I think you should move your code to onLoad

Well you got me there! Again. Took a little playing with some other things and had to repeat the lookup in onload but it worked! Thanks much!