[jQuery] jQuery Validation Plugin

2009-05-22 Thread bhan...@hcinsight.com

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'
}

etcit causes the script to break.

I need a workaround if anyone has ever come across this problem..

Thanks in Advance


[jQuery] Appending a Rails Partial

2009-06-03 Thread bhan...@hcinsight.com

Im not sure which group to post in, so i thought i'd try both. Any
Rails peeps that use jQuery? Im having a problem.

I have followed Ryan Bates Screencast about inserting a partial with
jQuery, but i like to keep all my code in my application js.

This is what i have

$(document).ready(function() {
  $('#add_option').click(function() {
$(this).addPollOption();
  });
});

jQuery.fn.addPollOption = function() {
  $("#poll_options").append('#{escape_javascript render(:partial =>
"topics/poll_option", :object => TopicOption.new)}');
};

i have tried it with the #{} and the <%= %> both give the same result.

Instead of getting the partial to populate the div, it simply adds the
text to the div

#{escape_javascript render(:partial => "topics/poll_option", :object
=> TopicOption.new)}

Any thoughts?