cant help with the referencing problem, but you should never do a
(solely)client-side validation of user data anyway.
It’s always best to do this at the server since even though you
validated it with javascript the user can send you a manipulated
request with whatever data he chose. So client-side validation would
only be a user-friendly feature, cause he gets instant feedback.
Rails offers lots of options for (server-side) data validation
(validates_presence_of, validates_length_of,
validates_numericality_of…)
cant help with the referencing problem, but you should never do a
(solely)client-side validation of user data anyway.
It’s always best to do this at the server since even though you
validated it with javascript the user can send you a manipulated
request with whatever data he chose. So client-side validation would
only be a user-friendly feature, cause he gets instant feedback.
Rails offers lots of options for (server-side) data validation
(validates_presence_of, validates_length_of,
validates_numericality_of…)
thanks for the help! i used validates_length_of and it’s working
perfectly. Maybe one day i’ll go back to the javascript just to add
another user friendly reminder so they are aware before they submit the
form.
thanks for the help! i used validates_length_of and it’s working
perfectly. Maybe one day i’ll go back to the javascript just to add
another user friendly reminder so they are aware before they submit
the
form.
Coming in late, but this has worked for me… (wrapped to fit. i
hope). define the constants as necessary, change the instance
variables, etc.
chars left : <%= UserBlog::MAX_CHARS -
(@blog.body.length rescue 0) -%>