Form with placeholder

Permalink
Hi everyone,
Been a while since I was here last, and I can see a lot has happened :-)

I am intererested to hear if anyone outthere has info about a FORM plugin for the current version of Concrete5, that supports "placeholders" ?

Or if any of the different FORM add-ons could be converted to support placeholders?

//Carsten - Denmark

sabumnimdk
 
leinteractive replied on at Permalink Reply
leinteractive
+1 for forms with placeholders. Or a suggestion to implement this with the current form tool. Perhaps using the label text and turning that into the placeholder.
rijck replied on at Permalink Reply
rijck
+2 for forms with placeholders. Would like to be able to use icons as placeholders as well as text. Displaying an external label for each field adds so much extra height or width to a form.
MrKDilkington replied on at Permalink Reply
MrKDilkington
I am imagine the Form block could be modified to accept placeholders. External forms with placeholders could also be created.

It is recommended not to use placeholders in place of labels.

http://www.pardot.com/faqs/best-practices/placeholders-and-labels/...
http://www.nngroup.com/articles/form-design-placeholders/...
ChannelMarkerMedia replied on at Permalink Reply
ChannelMarkerMedia
One quick workaround is to do a str_replace to add the placeholder html attribute (check browser support) to the input

In 5.7 /concrete/blocks/form/view.php around line 86:

Remove the
<label>
and add something like:
<?php $question['input'] = str_replace('class="form-control"', 'class="form-control" placeholder="'.$question['question'].'"', $question['input']); ?>


My entire foreach (starting at line 86) looks like:

<?php  foreach ($questions as $question): ?>
         <div class="form-group field field-<?php  echo $question['type']; ?> <?php echo $errorDetails[$question['msqID']] ? 'has-error' : ''?>">
               <?php $question['input'] = str_replace('class="form-control"', 'class="form-control" placeholder="'.$question['question'].'"', $question['input']); ?>
            <?php echo $question['input']; ?>
         </div>
      <?php  endforeach; ?>


Note: Of course, it's bad practice to modify the core files, so copy view.php and override the core, or just make a custom template which is what I prefer
JohntheFish replied on at Permalink Reply
JohntheFish
Pixo's form templates addon includes a placeholder template. Its in the marketplace for 5.6 and currently under review for 5.7.