Is ist possible to define a placeholders for custom attributes in forms
Permalink
Hallo,
is ist possible to define placeholders for custom attributes in forms?
For example:
<input type="text" placeholder="Your Surname" ...
I look forward to your feedback. Many thanks
is ist possible to define placeholders for custom attributes in forms?
For example:
<input type="text" placeholder="Your Surname" ...
I look forward to your feedback. Many thanks
Thank you for your reply. I have checked the add-on. This does not work unfortunately.
The form Which one I mean is generated as follows:
Characterized unfortunately I can not put a Placholder. Do you have any other ideas ? I look forward to a short feedback.
Frank
The form Which one I mean is generated as follows:
echo $userAttr->render('form', $vo, true);
Characterized unfortunately I can not put a Placholder. Do you have any other ideas ? I look forward to a short feedback.
Frank
Hi Frank,
if I get it right, the form is not written by you but by the php you attached. And in that form is some text you like to replace but the text is actually part of an htm tag. What do you mean with characterized? Does it mean the text you want to replace is every time different?
The add-on is skipping any html tag in the search for placeholder, to make sure that you don't mess up your html code by accident. But you could remove this safety precaution.
Open up the file packages/text_placeholder_replacements/libraries/listeners/render.php. In line 106 replace
return str_replace($this->placeholder_cb, $this->replacements_cb, $matches[1]).$matches[2];
with
return str_replace($this->placeholder_cb, $this->replacements_cb, $matches[1]).str_replace($this->placeholder_cb, $this->replacements_cb, $matches[2]);
$matches[2] contains the skiped html tag. With the new line you do the replacing in the tag as well.
Let me know if it works ...
Daniel
if I get it right, the form is not written by you but by the php you attached. And in that form is some text you like to replace but the text is actually part of an htm tag. What do you mean with characterized? Does it mean the text you want to replace is every time different?
The add-on is skipping any html tag in the search for placeholder, to make sure that you don't mess up your html code by accident. But you could remove this safety precaution.
Open up the file packages/text_placeholder_replacements/libraries/listeners/render.php. In line 106 replace
return str_replace($this->placeholder_cb, $this->replacements_cb, $matches[1]).$matches[2];
with
return str_replace($this->placeholder_cb, $this->replacements_cb, $matches[1]).str_replace($this->placeholder_cb, $this->replacements_cb, $matches[2]);
$matches[2] contains the skiped html tag. With the new line you do the replacing in the tag as well.
Let me know if it works ...
Daniel
Hi Frank,
I updated the add-on. There is now a class you can use to replace html code very easy on a PHP level. You could do something like:
You'll find a more detailed description in the developer section of the add-on:
http://www.concrete5.org/marketplace/addons/text-placeholder-and-re...
Cheers,
Daniel
I updated the add-on. There is now a class you can use to replace html code very easy on a PHP level. You could do something like:
<?php Loader::model('replacements', 'text_placeholder_replacements'); Replacements::add('placeholder', 'replacement', true); ?>
You'll find a more detailed description in the developer section of the add-on:
http://www.concrete5.org/marketplace/addons/text-placeholder-and-re...
Cheers,
Daniel
<input ... placeholder="<?php $u = new User(); if ($u->getUserName()) echo $u->getUserName(); ?>"/>
If you are looking for a way to place placeholder on your site which you can manage from one place in the dashboard, you could use the Text Placeholder and Replacements add-on:
http://www.concrete5.org/marketplace/addons/text-placeholder-and-re...