Moonshine-IDE / Moonshine-IDE

Moonshine is a free and open source middleweight IDE built with ActionScript 3 for ActionScript 3, Apache Flex®, Apache Royale™, and Feathers development, with Cloud and Desktop support.
http://moonshine-ide.com/
Other
122 stars 16 forks source link

Handle multi value list where type is Checkbox #1146

Open piotrzarzycki21 opened 1 year ago

piotrzarzycki21 commented 1 year ago

UPDATE with example image: image

UPDATE: Example database 2023_01_10__TestKeywordFields.nsf.zip

UPDATE: Generated DominoVisualEditor project:
2023_01_17__TestKeywordFields.zip

JoelProminic commented 1 year ago

The checkbox fields have type="keyword" and keywordui="checkbox". There are other keywordui types, but we'll return to these later.

<Field value="IsLatestState" 
    ...
    type="keyword"
    keywords="VHJ1ZSB8IHRydWU="
    keywordui="checkbox"
    ... />

In Domino, all checkboxes are checkbox group. You can find the Base64-encoded values in keywords. The format is:

Label1 | value1
Label2|value2
LabelAndValue3
...

For the entries with |, the first value is the label for display in the UI, and the second is the actual value that should be stored if the checkbox is enabled. Trim the label and value. If only one value is provided, it should be used as both the label and value.

The values are stored as a multivalue text field. If a value is present in the collection, then the corresponding checkbox should be enabled.

So, if the value is:

value1
LabelAndValue3

Then Label1 and LableAndValue3 should be enabled in the UI.

In the original example, keywords="VHJ1ZSB8IHRydWU=" decodes to the most common use case in our datbases:

True | true

This is a single "True" checkbox. If it is enabled, the value is ["true"]. If it is not enabled, the value is [].

I have a test database with examples for this, but it probably contains examples of other keyword fields. If these are too mixed together, I'll create another quick test database.

piotrzarzycki21 commented 1 year ago

I have a test database with examples for this, but it probably contains examples of other keyword fields. If these are too mixed together, I'll create another quick test database.

@JoelProminic did you provide me that database ?

piotrzarzycki21 commented 1 year ago

@JoelProminic before I start implementing that I would like to agree on how all of that should behave. If my multi value list is checkboxy type in readonly mode I'm planning to display list of checkboxes with values. However how it should behave if user switch things to Edit mode ? Should it be the same list where user can select/unselect stuff ?

JoelProminic commented 1 year ago

@piotrzarzycki21, I added an example image to the description to help clarify this. This type of field is effectively a checkbox group. They should be displayed as checkboxes in both Edit and Read-Only modes. In read-only mode, the checkboxes should have updates disabled for clarity.

In Domino, the form switches automatically to Edit mode if you try to click a checkbox, but we don't need to match that here.

JoelProminic commented 1 year ago

I added my example database from the screenshot to this issue.

piotrzarzycki21 commented 1 year ago

@JoelProminic can you convert that db to Visual Editor project ?

piotrzarzycki21 commented 1 year ago

More question while I'm trying to implement that:

  1. When I have following code in intermediate XML:
  <keywords columns="1" helperbutton="false" ui="checkbox">
                  <textlist>
                    <text>True | true</text>
                  </textlist>
 </keywords>

Does that mean I will have in output couple of checkboxes if I have something like this?

<keywords columns="1" helperbutton="false" ui="checkbox">
                  <textlist>
                    <text>True | true</text>
                    <text>Test | false</text>
                  </textlist>
 </keywords>
  1. What means if I don't have textlist ? What should I display ?
  <Field allowmultivalues="true" hide="" id="" keywordui="checkbox" kind="editable" maxlength="" name="DataInvalid" numberColumns="1" required="false" type="keyword" value="DataInvalid">
        <keywords columns="1" helperbutton="false" ui="checkbox"/>
      </Field>
JoelProminic commented 1 year ago

I converted the example database with NSFConverterPortalProject and attached it to the description.

We reviewed the case with a missing textlist today, and this is a mistake in the Domino form. I confirmed that this field doesn't work in the UI. I'm surprised that Domino Designer let me save the form like this. If you see a case like this, then you can leave it empty like you do for the formula case.

JoelProminic commented 1 year ago

I checked the Mumble database, and I couldn't any more cases of checkboxes with no specified values. I do see that the developers here chose different values for the "booleans" than I did, but so we don't want to specialize the code too much for "True | true"

<text>Yes | yes</text>

# "Yes" is the value and label here
<text>Yes</text>

# This case is backwards in casing from how I use it
<text>true | True</text>

<text>Checked!</text>

# I have seen the convention of using "1" for true in other Prominic databases
<text>Closed | 1</text>
piotrzarzycki21 commented 1 year ago

@JoelProminic when I deployed TestKeywordFields.nsf database to the server I'm getting error 404 when I'm trying to read list of checkboxes. I'm not sure what could be the reason. I'm deploying it using demo-1.1 vagrant project.

piotrzarzycki21 commented 1 year ago

It's cors issue: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:8080/TestKeywordFields.nsf/TestCheckboxRead?OpenAgent. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 404.