Manage Learn to apply best practices and optimize your operations.

Control action buttons visibility on a child

When launching a child window from a parent (embedded view), and the parent document is not in edit mode, you do not want the child to be edited. If it is edited, the changes will not relay to the formulas on the parent. This code lets you hide the edit/read and save buttons on the child document/window based upon whether or not the parent window document is in edit or read mode.

In the onLoad event of the parent form put: f = document.forms[0]; so the form is identified.

Put a field on your parent form called "editRead" without the quotes. It should be a number field and Computed for display. The formula for that field should be "@IsDocBeingEdited" without the quotes.

Put the field in between the square brackets in the following script tag below after copying this script to the top of your form:

<SCRIPT LANGUAGE="JAVASCRIPT"> var docMode='[field goes here]'; </SCRIPT>

Swipe the whole script tag including the field and make it pass through html. This makes the value of the computed for display field available to JavaScript.

Create your action buttons on the form for Save, Edit/Read and Delete (if you need all of them) and place them where indicated in the JS below.

<div align="left" ID=MyDiv5 STYLE="position:relative; visibility:hidden"> Buttons go here </div>

Swipe the code above and make it pass through html leaving the buttons out of the pass through selection.

Put the following JavaScript in the onLoad event of your child document:

var editRead2 = window.opener.document.forms[0].editRead.value; if (editRead2 == 0) { = "hidden";} else if (editRead2 == 1) { = "visible"; }

If you launch a document in an embedded view on the parent document and the parent is in read mode, there will be no way to save the child document. If the parent is in edit mode, the buttons will be available. When saved, you will be able to update the parent document. If you need to refresh the parent to see the tip, see the tip I posted a few weeks ago entitled "Refreshing a parent form from a child window.?

Dig Deeper on Domino Resources - Part 3

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...