Page 1 of 1

More Button in Subform Challenges

Posted: Wed Nov 04, 2015 7:22 pm
by dotburn
My problem also includes the need to continue to nest subforms to subforms (ie parent object has n number of child objects. Each Child Object has number of children. I was hoping place a button in the subform which then takes you to the browse screen for the third level.

When I include the form for the Button Object of the subform. when I click it opens the edit window and not the browse. I have yet to fix the passed in Record ID of the parent object

Re: More Button in Subform Challenges

Posted: Thu Nov 05, 2015 12:05 am
by admin
dotburn,

The way to do this is update a field on the Edit Form with the Child's id on the button's onfocus event (before the browse opens).

Then set the button's Default Filter for Browse.
button1.PNG

Code: Select all


function set_child_filter(t){
    
    var p = t.getAttribute('data-prefix');
    var v = $('#'+p+'_nuPrimaryKey').val();
    
    if(v == ''){
        alert('This child has not been saved');
        $('#the_id').val('______________');   //-- filters everything 
    }else{
        $('#the_id').val(v);
    }
}

button2.PNG
Capture3.PNG
Getting this..
Capture2.PNG
Steven

Re: More Button in Subform Challenges

Posted: Tue Nov 10, 2015 8:25 pm
by dotburn
OK, I am quite new at this so bear with me please.
Not sure how to post screen shots either...

I added the java code for the function on the form hosting the first subform. Should data-prefix be substituted with the element name for the primary key driving the first subform? Currently this system assigned key is not in the first displayed subform.

I added the event to the button object displayed in the first subform as well as setting the default browse to #the_id# as directed.

The behavior upon clicking the button is to now bring up the browse version of the second child as desired, but the display is empty not showing the children for the selected parent.

Thanks for the help so far.