Thread jquery: validation-plugin (2 answers)
Opened by Kuerbis at 2011-09-04 08:55

Kuerbis
 2011-09-04 13:41
#152084 #152084
User since
2011-03-20
947 Artikel
BenutzerIn
[default_avatar]
Es waren die keys - die beziehen sich die name Attribute. So funktioniert es jetzt:

Code (html): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="jquery-validation-1.8.1/jquery.validate.js"></script>
    <script type="text/javascript">
        $( document ).ready( function() {
            $( "form" ).validate( {
                rules: {
                    menge_1: "required",
                    bezeichnung_1: {
                        required: true,
                        minlength: 2
                    },
                    euro_stueck_1: "required"
                },
                messages: {
                    menge_1: "Please enter 'Menge'",
                    bezeichnung_1: {
                        required: "Please enter 'Bezeichnung'",
                        minlength: "'Bezeichnung' must consist of at least 2 characters"
                    },
                    euro_stueck_1: "Please enter 'Euro/Stück'"
                }
            });
        });
    </script>
</head>
<body>
<form>
    <table id="product">
        <tr id="tr_0"><th>Menge</th><th>Bezeichnung</th><th>Euro/Stück</th></tr>
            <tr id="tr_1">
                <td><input name="menge_1" /></td>
                <td><input name="bezeichnung_1" /></td>
                <td><input name="euro_stueck_1" /></td>
            </tr>
    </table>
    <br />
    <input type="submit" value="OK"/>
</form>
</body>
</html>

View full thread jquery: validation-plugin