views:

10

answers:

0

I'm rendering the following input:

<td class="field <%= BookingExternalResource.Metadata.Value.CssClass %>"><%= Html.TextBox(string.Format("BookingExternalResource[{0}].Value", i), row.Value, new { style = "width: 60px;" })%></td>

So I've tried attaching a xVal validator like this:

<script type="text/javascript">
    xVal.AttachValidator("",
        { "Fields":
        [
            { "FieldName": "Value", "FieldRules":
            [
                { "RuleName": "DataType", "RuleParameters": { "Type": "Decimal" },
                    "Message": "Este valor não tem um formato válido."
                },
            ]
            },
        ]
        },
        {})
</script>

Once I run the page, the field Value isn't getting any validation at all. Where am I going wrong? (this is an MVC application and I'm not allowed to transpose this validation to the server side)