Mhmd Mhmd - 2 months ago 8x
jQuery Question

custom validation help (Mvc Foolproof )

i have a DropDownListFor

@Html.DropDownListFor(model => model.Payment)
with values

  • cash

  • money order
    and i have TextBoxFor
    @Html.TextBoxFor(model => model.PaymentType)
    , i want to make the TextBoxFor Required only if the user select money order from the DropDownListFor,i have Mvc Foolproof and i was trying to use RequiredIf

here is my ViewModel

public string PaymentType { get; set; }
public string Payment{ get; set; }


@Stephen Muecke

[RequiredIf("Payment", "money order")]