Enable / disable editing form field from code

I am not a Notes programmer, however, for my sins, I recently worked on some Notes features for my own project. I need to enable / disable editing of a field as appropriate. It seems to me like this is a pretty standard feature I need, but I can't find any information on how to do it.

In the form setup code (and another field onchange

), something like the following:

if some requirement = true then
    textField.enable = true
else
    textField.enable = false
end if

      

I've seen other places where there is a conditionally hidden paragraph traversal based on some code, having 2 paragraphs with opposite hide conditions, one with an editable margin, the other with a calculated margin. However, I don't know enough about Notes to see how this is implemented (I can see it being done on other forms, but there seems to be some "magic" steps in Notes that I either don't see or don't get ).

[EDIT] The answer from kerr seems to be what I'm looking for, but I still can't figure out where the InputEnabled property is. I must say in the original question, I am using Notes 7.0.3.

To be fair, it doesn't matter what the circumstances are, when to enable / disable the field, it's just some kind of boolean condition that is set, in my case only when the form is loaded, so I don't even have to worry about it changing dynamically while the form is being displayed.

I have a few issues with Notes, my biggest bug that is so tightly tied to the designer UI which is full shite. I can do things like this programmatically in most GUI languages ​​(C #, Java, Delphi, even VB), but I need to open the property fields in Notes and set them correctly.

This would be fine as an optional method, but forcing you to go this way means you can work, and also the IDE allows you in this case, and here the IDE is actively working against you. You cannot open multiple functions / scripts, you cannot change them from one script to another without going back to the menu on the left, you cannot easily find the codebase for variable / field entry (and trust me, this is a serious mistake for me. because either Notes or the internal codebase in my case seems to use globals a lot!) you can only work with fields, although the property fields that are displayed you cannot edit the code in Designer when debugging through the main client Notes.

While Java coding is better than lotusscripts, it's still pretty crappy (why can't you debug INTO Java code? Why would you need to re-import JAR files for each Java class, does each class have a different CLASSPATH ???) ... This may have been improved in Notes 8, I heard it is based on Eclipse. Does anyone know if this is true or not?

+1


source to share


2 answers


This will help you learn more about the "circumstances", but the most common way to deal with this is to use the hide formula in the field you want to enable / disable.

You don't technically enable or disable the field, you just hide it, but it usually works just as well.

Because there are several events in Notes, developers typically use document refresh as an "event" to make a field hide or show.

Suppose you have two fields: TriggerField and Subject. Let's also say that you want to disable the theme based on the value in the TriggerField. The easiest way to do this is to set the TriggerField as a list box in the dialog box and check the Update Fields When Keyword Changes check box. This means that when the value of the dialog box changes, the entire document will be updated.



Then in your hidden form in the Subject field, you specify your criteria for when to show or hide this field. The field values ​​change at any time, and then the document (ie the Form) is updated, which are hidden when the formula is re-evaluated.

There are other ways, depending on your circumstances, to fix this problem. If you want the user to update the form on their own, place a button on the form that invokes @Command ([ViewRefreshFields]). You can add any other formulas to this button before the update command if you want to make other changes to the form at the same time.

Another option is to create a specific field for display only. Then create a button that launches LotusScript so that users can modify this displayed field. In a script, you can ask the user for a value, set only the field to display, and then call the document update.

0


source


In ND7 and up, if you just want to disable the input field, write the appropriate formula in the InputEnabled section of the field you want to disable.

So I have two fields, one called Trigger, a checkbox with the value "On" and another Subject, which is a textbox. When the Trigger is set, I want the Subject value to be on.

I just put the following formula in the Input Enabled element in the Subject field:



Trigger = "On"

      

I also want this to be recalculated when the Trigger value changes, so I select the "Update fields on keyword change" option in the Trigger field.

If you are stuck with an older version, you need to hide the paragraphs accordingly.

0


source







All Articles