Overriding placeholder text value in custom FormBuilder


#1

Greetings,

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: http://pastie.caboo.se/79203

Thanks for the help.

  • j

#2

anyone?


#3

On 7/17/07, Justin W. removed_email_address@domain.invalid wrote:

My code is here for reference: http://pastie.caboo.se/79203

Thanks for the help.

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.