Overriding placeholder text value in custom FormBuilder


I have a custom FormBuilder class I've created that inputs a placeholder text value on a text_field. It works great unless a user has errors in the form. In that case, the user's previously submitted values are overridden by my FormBuilder's placeholder value.

How can I override the placeholder value with the user's submitted values when rendering an InvalidRecord error?

My code is here for reference: Parked at Loopia

Thanks for the help.

- j


Hi Justin,

Isn't it enough to only set the content if the field is blank? i.e., wrap your javascript calls to placeholder() in "if (this.value == '') { ... }" (or make placeholder itself check the condition), and set the :value option to the placeholder text only if the value is blank? The value can be obtained with `object.send(method)' in your form builder method.

I must admit as a user, though, I'm not usually a fan of "placeholder text."

Hope this helps, George.