NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Rene Simons on November 07, 2011, 10:46:36 PM
-
Hi Bruce,
I think this one is for you.
I have a form with a parent/child browse situation..
When I click the header bar of the parent browse, the child browse refreshes to empty, as it should.
When I click the insertbutton, I get a popup insert form for a chld record.
The foreign key field in the child record however, is NOT primed with the p_web.gsv('Parentkey') value as there is none (the prime is done through the prime tab).
I know I could catch this one in the validation but do you have a more elegant solution for this?
Cheers,
Rene
-
Hi,
I "solved it" bij putting:
if p_web.gsv('Parent:recordid') = ''
loc:invalid = 'Child:Fieldname'
loc:alert = 'Inserting a child record is not possible when no valid perent is selected.'
end
in embed
! Start of "End of Stage-Case statement in Form"
! [Priority 5000]
Cheers,
Rene
-
I'm not sure i understand this bit;
>> The foreign key field in the child record however, is NOT primed with the
>> p_web.gsv('Parentkey') value as there is none
>> (the prime is done through the prime tab).
You are, or aren't doing a prime on the prime tab? the child is, or isn't, related to the parent?
What is the child browse filter set to?
cheers
Bruce
-
Yeah,
Here is the language barrier kicking in.
The browses are related 1:N.
The foreign key field in the child record is the primary key of the parent.
What happens is:
I click (by accident) the header of the parent browse in the part where there's no sort link.
At that moment, the sessionvar for the primary parent key is nullified, which is about right because in fact no parent record is selected. Yet.
The child browse is refreshed but as the session var for the primary parent key is nullified, no matching records are found to be shown in the child browse.... Yet.
The insert button of the child browse is still available and when I click it, the insert_child_record_form pops up.
In the template for the child form, in the prime tab, i prime the foreign key field which refers to the parent record, using the session var for the unique parent key, which is nullified by clicking the header. In other words the foreign key also gets nullified.
In the meantime I fill out the child form and click save.
And voila, an orphan child record is created.
After that, when i accidently click the header of the parent browse, I get results in the child browse.
Imho this is a bug.
Cheers,
Rene
-
Have you tried putting a condition on the child insert button - probably the sessionvar for the primary parent key? That way you can't insert a child record unless you have a parent record.
-
>> Imho this is a bug.
I agree. I've tweaked 5.41 so that clicking on the header accidentally does nothing. I think that stops the problem before it starts.
cheers
Bruce
-
Hi guys,
Yes I did do a work-around but I prefer Bruce's solution. Ofcourse :)
Thnks for your time.
Rene