Required fields, if other field is empty

So I am very new at Appian and I have a question about required fields.

I have an interface with two sections:

In one section is just a field where one can enter an ID number.

The other section consists of several fields that are required, if the ID number of the first section is unkown.

So basically, I enter the ID number, the fields shoudl not be required, but as long as the ID field is empty all the other fields should be required.

 

Can anyone help?

  Discussion posts and replies are publicly visible

Parents
  • load(
      local!id,
      {
        a!sectionLayout(
          label: "Section1",
          contents: {
            a!textField(
              label: "Text",
              labelPosition: "ABOVE",
              value: local!id,
              saveInto: local!id,
              refreshAfter: "UNFOCUS",
              validations: {}
            )
          }
        ),
        a!sectionLayout(
          label: "Section2",
          contents: {
            a!textField(
              label: "Text1",
              labelPosition: "ABOVE",
              saveInto: {},
              refreshAfter: "UNFOCUS",
              required: isnull(
                local!id
              ),
              validations: {}
            )
          }
        ),
        a!textField(
          label: "Text2",
          labelPosition: "ABOVE",
          saveInto: {},
          required: isnull(
            local!id
          ),
          refreshAfter: "UNFOCUS",
          validations: {}
        )
      }
    )
    Hi christianr0002,

    Save value of ID in some local variable and compare that variable in "required" property of second section fields by using isnull() function if  local variable is null then return true fro "required" property otherwise false...

    in this way you can handle the situation....

    Refer the following code...

     

    load(
      local!id,
      {
        a!sectionLayout(
          label: "Section",
          contents: {
            a!textField(
              label: "Text",
              labelPosition: "ABOVE",
              value: local!id,
              saveInto: local!id,
              refreshAfter: "UNFOCUS",
              validations: {}
            )
          }
        ),
        a!sectionLayout(
          label: "Section",
          contents: {
            a!textField(
              label: "Text1",
              labelPosition: "ABOVE",
              saveInto: {},
              refreshAfter: "UNFOCUS",
              required: isnull(
                local!id
              ),
              validations: {}
            )
          }
        ),
        a!textField(
          label: "Text2",
          labelPosition: "ABOVE",
          saveInto: {},
          required: isnull(
            local!id
          ),
          refreshAfter: "UNFOCUS",
          validations: {}
        )
      }
    )

    see the out put of above code as...

    when id is null

    when id is not null

    Thanks and Regards,

    Amit Behere

Reply
  • load(
      local!id,
      {
        a!sectionLayout(
          label: "Section1",
          contents: {
            a!textField(
              label: "Text",
              labelPosition: "ABOVE",
              value: local!id,
              saveInto: local!id,
              refreshAfter: "UNFOCUS",
              validations: {}
            )
          }
        ),
        a!sectionLayout(
          label: "Section2",
          contents: {
            a!textField(
              label: "Text1",
              labelPosition: "ABOVE",
              saveInto: {},
              refreshAfter: "UNFOCUS",
              required: isnull(
                local!id
              ),
              validations: {}
            )
          }
        ),
        a!textField(
          label: "Text2",
          labelPosition: "ABOVE",
          saveInto: {},
          required: isnull(
            local!id
          ),
          refreshAfter: "UNFOCUS",
          validations: {}
        )
      }
    )
    Hi christianr0002,

    Save value of ID in some local variable and compare that variable in "required" property of second section fields by using isnull() function if  local variable is null then return true fro "required" property otherwise false...

    in this way you can handle the situation....

    Refer the following code...

     

    load(
      local!id,
      {
        a!sectionLayout(
          label: "Section",
          contents: {
            a!textField(
              label: "Text",
              labelPosition: "ABOVE",
              value: local!id,
              saveInto: local!id,
              refreshAfter: "UNFOCUS",
              validations: {}
            )
          }
        ),
        a!sectionLayout(
          label: "Section",
          contents: {
            a!textField(
              label: "Text1",
              labelPosition: "ABOVE",
              saveInto: {},
              refreshAfter: "UNFOCUS",
              required: isnull(
                local!id
              ),
              validations: {}
            )
          }
        ),
        a!textField(
          label: "Text2",
          labelPosition: "ABOVE",
          saveInto: {},
          required: isnull(
            local!id
          ),
          refreshAfter: "UNFOCUS",
          validations: {}
        )
      }
    )

    see the out put of above code as...

    when id is null

    when id is not null

    Thanks and Regards,

    Amit Behere

Children
No Data