locked
Conditionally Required field based on the value in another field RRS feed

  • Question

  • New to Lightswitch and VB.Net

    I have two fields "value" and "notes". If value = x I would like to make the notes field required.

    I'm sure this is documented somewhere, but my Google and Bing searches have been fruitless. If someone could either help me with this or point me to the correct resource, it would be appreciated

    Monday, July 11, 2016 3:03 PM

Answers

  • Hi!

    If you are working with silverlight client you could implement this on entity level.. so when you define property on your entity, you have there validate method, then it depends on your properties type but can be something like:

    Private Sub property2_Validate(results As EntityValidationResultsBuilder)
                If me.property1 = x andalso isNothing(me.property2) then results.AddPropertyResult("Error!", ValidationSeverity.Error)
            
    End Sub

    check some links here and here.. hth..

    Kivito



    Nobody expects the Spanish Inquisition! (M.P.F.C.)

    • Proposed as answer by Angie Xu Thursday, July 21, 2016 5:10 AM
    • Marked as answer by Angie Xu Thursday, July 21, 2016 5:10 AM
    Tuesday, July 12, 2016 5:59 PM