Subform with editmode issue

Hey,

I have a problem with editmode in subform. I’ve created two subforms in a form for data entry. If the isNewDoc, users should be able to enter into these subforms, however, !isNewDoc, users can only edit one of the subforms.

So far, I’ve tried lots of ways but i couldn’t get it working. Both of the subforms are editable at all times. Anyone come across this problem before? How to solve this?

Thanks in advance.

Subject: RE: subform with editmode issue

You have to explain in more detail what you’re doing, or else we cannot tell what you’re doing wrong.As far as I know, there is no option to make a subform non-editable. How are you attempting to make this happen? Please be detailed.

How do you open the form? If with some code, we need to see the code.

What types of fields are on the subforms?

Do you need the fields on a subform to become non-editable when the user saves the new document but does not exit?

Does whatever you’re trying, work when you close and reopen the document?

If you use a subform formula to select a subform based on whether it’s a new document, know that subform formulas only are evaluated when the document is opened – not when it’s refreshed.

If you’re using “field editable” formulas in the subform’s fields, those should be applied when you refresh, but they don’t work for every kind of field, I think – maybe not for “notes style” fields. Someone correct me if I’m wrong.

Subject: RE: subform with editmode issue

OK…

First of all, I’ve created two subforms, subformA and subformB. I used these two subforms in a form in attempt to prevent users from being able to edit data from subformA. Basically what I wanted to do is to have certain fields such as Name, Reference No and Reference Date non-editable while users can keep adding other details to the form when they click “Add More Details” button.

When users click on “Add More Details”, I wanted to create a new document of the same form but this time users don’t have to enter the data in subformA, however, there are not allowed to edit the data either.

Things I’ve tried is editmode = false in postopen for subformA. The thing is the moment I click on any of the fields from subformB, the whole form turns editable. So what I’m doing right now is using uidoc.GOTOFIELD(“fields_in_subformB”) in the ENTERING() of fields in subformA if there are values in the field. But i’m not sure if this is alright.

Subject: RE: subform with editmode issue

You cannot set the editmode on a sub-form. Editmode is a property of the NotesUIDocument - the full document based on the form you are using. You cannot make bits of it editable or not editable in this way.

One way to do this is to create two subforms with the same fields on them both (Name, Refererence No etc):

SubformA - fields are Editable

SubformB - fields are Computed when Composed.

The fields which are always editable (which your refer to as subformB) can go on the main form. There is no need to add them to yet another sub-form.

You insert one subform into your form as a computed subform with a formula like:

@if( @IsNewDoc ; “SubformA” ; “SubformB” ).

An alternative is to use the ‘Input Enabled’ formula of the fields. In this property you enter a formula which evaluates to true or false (e.g @if( @IsNewDoc ; @True ; @False ).

Then you don’t need to worry about sub-forms at all.