placeholder icon indicating copy to clipboard operation
placeholder copied to clipboard

Hidden forms not handled?

Open lisad opened this issue 12 years ago • 1 comments

My site has a bunch of hidden forms. E.g. when the user clicks a link to "+ Invite a friend", the invite friend form .show() is called. These hidden fields aren't handled by this plugin AFAICT. I did some basic debugging and found out that the iteration through each ":input[placeholder]" only covers those which are visible. I confirmed that's the case for Chrome as well as for IE8 where I'm interested in getting the placeholder plugin working, so I assume that's normal browser behavior not to iterate through the hidden fields.

My question for this plugin is, would it be a good idea to support those hidden inputs also ?

I'm trying to make the functionality work for my own site by adding a function "setupMorePlaceholders" which could be called when a hidden div is shown. I am not a Javascript expert, so I don't know how better to do it. My best idea is to call that function manually after each time I call "$(#the_hidden_div).show()". Combined with making the placeholder internal functions be available outside the closure, this is working for me.

lisad avatar May 28 '12 19:05 lisad

I should add, that not all the forms which appear start out as hidden. Some which need to be addable more than once (add a friend, add another friend) are added to the document right when the user clicks on the link. I used the pattern from RailsCast #197 to do this. (http://railscasts.com/episodes/197-nested-model-form-part-2). So although I did look at finding all hidden input fields and calling setupPlaceholder on each, I concluded that wouldn't work for fields added after the document is loaded.

lisad avatar May 28 '12 19:05 lisad