Label as placeholder

Permalink Browser Info Environment
Hi Jordan,

I'd like to have the label (e.g. your name, your message etc.) as placeholder in the input fields. Is there a way to change some php in the view.php to get this running?

Best Regards
Torsten

1 Attachment

Type: Discussion
Status: In Progress
tsilbermann
View Replies:
jordanlev replied on at Permalink Reply
jordanlev
Hi Torsten,
There is a way, but it's not very straightforward. You need to rewrite the html strings that concrete5 generates for each field. I'd recommend just using my ajax form template instead, which includes this functionality:
https://github.com/jordanlev/c5_ajax_form...

Or, if you don't want that, you could at least look at the code to see how I did it -- it's in /blocks/form/controller.php, search the file for the word "placeholder" to see what I'm doing.

Good luck,
Jordan
FatTony1952 replied on at Permalink Reply
FatTony1952
Hey jordanlev!

I'm looking for a solution to the placeholder issue as well. I haven't found in the Ajax Form where it mentions placeholders and I don't have a controller.php located where you've indicated within the package. I do have one located at packages > ajax_form.

The controller.php located in the core C5 forms directory doesn't have anything about placeholders either.
jordanlev replied on at Permalink Reply
jordanlev
It's not in this addon, nor is it in the "Ajax Form" addon that's in the marketplace (nor is it in Concrete5's form block controller) -- instead it's in the github repository I linked to above (https://github.com/jordanlev/c5_ajax_form... ).
FatTony1952 replied on at Permalink Reply
FatTony1952
Friday must've been a long day. I completely missed that link.

Thanks!
SteamSynthetic replied on at Permalink Reply
SteamSynthetic
Wanted to try this out, but after following the instructions, I got
Warning: Invalid argument supplied for foreach() in ../public_html/blocks/form/view.php on line 111

which is
<?php foreach ($questions as $question): ?>

The form folder is in the root blocks folder, not in the concrete folder.
ideas?
jordanlev replied on at Permalink Reply
jordanlev
Did you copy just the view.php file? Or did you also copy all the other files from that github repo ("controller.php", "tools", etc.?).
SteamSynthetic replied on at Permalink Reply
SteamSynthetic
I copied everything.
jordanlev replied on at Permalink Reply
jordanlev
Sorry, I'm getting a little jumbled because we're talking about the ajax form addon here in the form-tableless-layout forum. If you could ZIP up your entire /blocks/form directory (the one at the top-level of your site, not the one in /concrete) and post that, I can try to take a look when I have some time.
SteamSynthetic replied on at Permalink Reply 1 Attachment
SteamSynthetic
Yeah. I have attached it, but its quite literally a direct download from your gitrepo.

This is my exact steps.
1.) Downloaded from repo and extracted.
2.) Took the "form" folder and placed into the top level blocks folder in my concrete installation.
3.) Made sure the form I was applying this to, did not have a custom template already.
jordanlev replied on at Permalink Reply
jordanlev
Unfortunately I'm unable to recreate the problem. What version of C5 are you running? And what fields did you configure in the form (when you edit the block on the page)?
SteamSynthetic replied on at Permalink Reply
SteamSynthetic
I will make a screencast and show you shortly.
ally2112 replied on at Permalink Reply
ally2112
Hi Jordan,

This is great!

Is it be possible to combine this add ajax form template with the form-tableless-layout, allowing placeholder text for that template too?
jordanlev replied on at Permalink Reply
jordanlev
The current "ajax form" template on github (which is where I'm updating it these days... not the marketplace which is a bit out of date at this point) has built-in placeholder functionality, and the template is just as customizable as the form-tableless-layout one is:

https://github.com/jordanlev/c5_ajax_form#placeholder-labels...
thenine replied on at Permalink Reply
thenine
This is GREAT. Thank you very much jordan. Very useful!!!
ShardCode replied on at Permalink Reply
ShardCode
I have been trying to do this for TWO days.. Jorden you legend. IT WORKS!

Question: How do I style the placeholder ... I've simply made the input box bigger via font-size but not the placeholder is out of place.. also i'd like to get rid of the * in the span tag- which i can also do via styling the placeholder... right.. right?
jordanlev replied on at Permalink Reply
jordanlev
Here's how to style placeholders:
http://css-tricks.com/almanac/selectors/p/placeholder/...

To get rid of the asterisk just edit the template file and remove it there.
cebabbage replied on at Permalink Reply
cebabbage
This is exactly what I need. However, Concrete5.7.3 does not have a top level blocks folder. Could you please point me where to put this please?
jordanlev replied on at Permalink Reply
jordanlev
I haven't used 5.7 yet so I'm not 100% sure where things have moved to. I believe though that there's an "application" directory that now has the other site folders in it (blocks, theme, etc)?

-Jordan
cebabbage replied on at Permalink Reply 1 Attachment
cebabbage
Thanks. This isn't working as a standalone fix so I need to use the Form Tablesless Layout addon but it's not compatible with concrete 5.7.3. I am receiving the following error

"This package is corrupted. Make sure it has a valid controller.php file and that it has been updated for concrete5.7 and later."

Is there anything you can suggest please?
jordanlev replied on at Permalink Reply
jordanlev
I have not upgraded the addon to work with 5.7, so I'm not surprised it doesn't work. However, it appears that the core team has used this template as the default for the form block in 5.7 so you can just copy that instead of using this addon. As I said, though, I haven't used 5.7 yet so I unfortunately can't give you specific details on where this file lives or where to copy it to. (Perhaps try posting a question on the general C5 forums asking "how do I override the form block template" and someone with more 5.7 experience will know the answer?)

-Jordan

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.