A testpage would help. Can't see anything wrong with that code.

Jörn

On Tue, May 26, 2009 at 4:13 PM, Bob O <bhan...@hcinsight.com> wrote:
>
> So it seems im still having some issues..
>
> this is my html
>
> <form id="new_blog_post" class="new_blog_post" method="post" action="/
> blog_posts">
> <p>
> <label for="blog_post_title">Title</label>
> <br/>
> <input id="blog_post_title" type="text" size="30" name="blog_post
> [title]"/>
> </p>
> <p>
> <label for="blog_post_body">Body</label>
> <br/>
> <textarea id="blog_post_body" rows="5" name="blog_post[body]"
> cols="28"/>
> </p>
> <p>
> <label for="blog_post_author">Author</label>
> <br/>
> <input id="blog_post_author" type="text" size="30" name="blog_post
> [author]"/>
> </p>
> <p>
> <label for="blog_post_permalink">Permalink</label>
> <span class="small_text">A hyphen separated title for URL's e.g. my-
> title</span>
> <br/>
> <input id="blog_post_permalink" type="text" size="30" name="blog_post
> [permalink]"/>
> </p>
> <p>
> <input id="blog_post_submit" class="btn" type="submit" value="Submit"
> name="commit"/>
> </p>
> </form>
>
> and this is my js placed after the jQuery and jquery.validate scripts.
>
> $(document).ready(function() {
>  $('#new_blog_post').validate({
>    rules: {
>      "blog_post[title]": "required",
>      "blog_post[body]": "required",
>      "blog_post[author]": "required"
>      },
>    messages: {
>      "blog_post[title]": "You must enter a title.",
>      "blog_post[body]": "You cant have a blog without a blog..?",
>      "blog_post[author]": "You must supplay an author name"
>      }
>  });
> });
>
> Any ideas?
>
>
> On May 26, 7:48 am, Bob O <bhan...@hcinsight.com> wrote:
>> Man i combed the docs for a day, and i missed that link everytime..
>>
>> Thanks Jorn.
>>
>> On May 23, 3:02 pm, Jörn Zaefferer <joern.zaeffe...@googlemail.com>
>> wrote:
>>
>> > You need to quote the full key, eg "name['name']": "required". 
>> > Seehttp://docs.jquery.com/Plugins/Validation#Fields_with_complex_names_....
>>
>> > Jörn
>>
>> > On Fri, May 22, 2009 at 10:15 PM, Bob O <bhan...@hcinsight.com> wrote:
>>
>> > > so as not to confuse..
>>
>> > > the name attribute looks like this
>> > > name="name['name']" for the input field
>>
>> > > and the js is
>>
>> > > rules: {
>> > >  name['name']: 'required'
>> > > }
>>
>> > > i noticed typos in the above question.
>>
>> > > On May 22, 12:36 pm, "bhan...@hcinsight.com" <bhan...@hcinsight.com>
>> > > wrote:
>> > >> Can anyone tell me how i can change which attribute on my form field
>> > >> triggers the validation?
>>
>> > >> currently it appears the be the name attribute. So in my Rails app
>> > >> using Rails helpers, it sets the name to somthing like formname
>> > >> ['fieldname'] and the whole name.
>>
>> > >> in my script if i do something like
>>
>> > >> rules: {
>> > >>   formname['fieldname]: 'required'
>>
>> > >> }
>>
>> > >> etc....it causes the script to break.
>>
>> > >> I need a workaround if anyone has ever come across this problem..
>>
>> > >> Thanks in Advance
>>
>>
>

Reply via email to