Announcement

Collapse
No announcement yet.

Dynamically Require Field

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

  • Dynamically Require Field

    I have a dependent select field (dependent upon another select above it.) It's not visible unless it's actually populated. The database field can be NULL.

    I'd like this select field to be required if it's showing (because it's populated and there is a possible selection to be made) and NOT required if it isn't (no choices anyway.) I don't see any way within the SC interface to dynamically require a field based on some parameter(s).

    Any suggestions for how I can do this?

    Thanks in advance.

  • #2
    You must do it with code.

    onBeforeInsert // onBeforeUpdate
    PHP Code:
    if ({value_of_your_other_dependant_select} > 0// if your dependant select is filled, then your second select shoyld be visible, and for this reason, required
    {
    if ({
    value_of_your_mandatory_select} != 0) {
     
    sc_error_message("Value of blababla is required");
    }

    /Giuseppe

    Professional Scriptcase Services
    Some Customers opinions

    Comment


    • #3
      Thanks, Giu. I finally got around to trying this out. With some modifications I was able to make it work.

      Comment

      Working...
      X