onLoad strangeness

Got a record view form, a list view form, and a find FID (consisting of globals).

The Find button on record view takes user to the FID, then search results show list view if n > 1.

Works great AFTER first find, or in any case if n = 1 (showing record view).

However, the first find after solution startup will return ALL records (on list form) if n > 1 regardless of criteria entered.

On the other hand, if after startup I go to list view then back to record view, then a find from record view works as expected.

So, I tried this routine for record view onLoad:

globals.the_usual_onLoad(); [addFoundSetFilterParam, etc.]
forms.record_view.goto_contact_list();
forms.list_view.goto_contact_record();

It works with respect to the initial find, but now unless such a find is conducted, the result is that navigation to that list view reveals a completely blank space (white screen) where the (custom) controller should be.

So, then I tried:

globals.the_usual_onLoad();
forms.record_view.goto_contact_list();
forms.the_custom_controller.controller.show();
forms.list_view.goto_contact_record();

Hey, it works great now. But I can’t help but wonder, why the hoops to jump thru? How can it be accomplished simply?

Further fun:

globals.the_usual_onLoad();
forms.list_view.controller.show();
forms.custom_controller.controller.show();
forms.record_view.controller.show();

Now, this one is really out to lunch. The result is a view of the record view (controller = none) showing the custom controller for the list view! And, when I enter design mode, the list view is what shows up.

So, I have a workable routine here (the second one), but I am not sure why. Or, rather, why the other two do not work.

Any insights?

Jim

When you try to access data through onload you have one issue, data is not loaded yet. That’s why you first have to ‘show’ the document before you can get to the data.

There is an other way to do a simulation of onload. I call it onShowFirst.

You add an onShow method to your form and retreive the first argument:```
var onShowFirst=arguments[0];


Now when onShowFirst is true the form shows for the first time. Here you can do any data related stuff for that form...

Hope this helps

Marcel, could you expand on that a bit? I get the general idea:

When you try to access data through onload you have one issue, data is not loaded yet. That’s why you first have to ‘show’ the document before you can get to the data.

There is an other way to do a simulation of onload. I call it onShowFirst.

Not getting the following, though:

You add an onShow method to your form and retreive the first argument:

Code:
var onShowFirst=arguments[0];

Now when onShowFirst is true the form shows for the first time. Here you can do any data related stuff for that form…

I tried adding it before my existing onShow method for a FID:

var onShowFirst=arguments[0];
forms.cont_com_call.elements.call_text.requestFocus();

I can’t get it to act as expected. As usual, it goes to the appropriate field, but the first time after restarting solution, I’ll see it pop back to record #1 in the calling form in the background. Next time, it does not.

Thanks,

Jim

Okay… I’ve added the setup for each FID to the main form’s onLoad:

previous line;
forms.cont_com_call.elements.call_text.requestFocus();
next line;

It works, as does calling a method from the FID that uses your line in that same onLoad method for the main form:

previous line;
forms.cont_com_call.Marcels_method();
next line;

But I can’t seem to get the “faux onLoad” routine to happen using onShow in the FID. Am I missing something? Or does it matter, anyway? I’ve got the thing working, and for that I am grateful! I guess I am just seeking a better understanding…

Thanks,

Jim

Happy that it works now :) What is the part you don’t understand?