Announcement

Collapse
No announcement yet.

Making a field mandatory depending on content in other fields

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Making a field mandatory depending on content in other fields

    Hi guys,

    Let's say I have a form with two fields, FieldA and FieldB, FieldA is of type Select, FieldB is of type Text.
    Now, depending on the choice the user makes in FieldA I am trying to make FieldB mandatory (which is by default optional).

    Whether the choice in FieldA causes this depends on the database entry (it's got a 1/0 column that determines whether the given status requires that choice).

    Now I know how to create an onchange Ajax event, I know how to determine whether FieldB should be mandatory. What I cannot get done so far is making FieldB mandatory.
    Basically, what I'm missing is a sc_field_mandatory({My_Field}, on/off) macro.

    I can enforce compliance using SQL, however throwing SQL errors is not exactly the best user experience.

    Cheers,
    Fred

  • #2
    You can do it, manually in onvalidate event.
    example: if ({FieldA} == "") {
    message error
    exit
    }

    Comment

    Working...
    X