We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

How to insert placeholder in join form? | Forum

Zachary
Zachary Oct 13 '13
Can anybody help me with how to insert placeholders on join form. I figured since they retrieved the label with $question.name that {input placeholder=$question.name} would work but it doesnt.


Anyone please

Daisy Team
Daisy Nov 1 '13
Zachary, do you want to add an additional field onto the join form? If so, you can add it via Admin Area. If I took you wrong - please provide us with more details.

The more details you will provide - the more efficient my assistance will be.
Jaswinder Singh
Jaswinder Singh Nov 1 '13
I also want to know how to apply custom attribute to the form fields

eg: {input name='identity'}  converts to <input type="text" name="......

i want to specify id, classes, placeholder etc but not able to do so because of this string conversion.

pls state a method to do so.....

Daisy Team
Daisy Nov 1 '13
Jaswinder, please explain in more details what exactly you want to do and how it should work.
Jaswinder Singh
Jaswinder Singh Nov 1 '13
in "homepath/ow_system_plugins/veiws/controllers/sign-in.html"

input field are encode, like username field is {input name='identity'}

i want to add some css classes and a placeholder to very possible field be it of sign-in form or join form

what i did is added classes and placeholder to this string {input name='identity' class="myclass" placeholder="Enter your username"}

and it produced a 500 error several times

after some tries it displayed the sign-in form but the css class and placeholder i added was missing...

i want to modify the fields with a field placeholder and some additional classes, so kindly pls let me know the doing this


important: don't stick to sign-in form fields, i want a way which can help me in customising overall fields (join,sign-in,verify,forgot forms) if i have to change multiple pages to do so i'm ready

The Forum post is edited by Jaswinder Singh Nov 1 '13
Daisy Team
Daisy Nov 6 '13
Ok, let's take an example the Sign in form.

To add a filed onto this form first you should:

- describe this field in /ow_system_plugins/base/components/sign_in.php file. For example:

        $foo = new TextField('foo');
        $foo->setRequired(true);
        $foo->setHasInvitation(true);
        $foo->addAttribute('class', 'foo');
        $foo->setInvitation(OW::getLanguage()->text('foo', 'component_foo_login_invitation'));
        $form->addElement($foo);

- then add this field via /ow_system_plugins/veiws/controllers/sign-in.html. For example:

               <div class="foo">
                    {input name='foo'}
                </div>

Also, do not forget to add a data processing for this field. You can use the Sign in form fields as an example.

The Forum post is edited by Daisy Nov 6 '13
Ebenezer Obasi
Ebenezer Obasi Jun 3 '14
@Jaswinder, Zachary


I think Daisy doesn't really get the picture of what you are asking for. You can try this code {input name=$question.name placeholder=$question.name} in the join page.


@Daisy


The placeholder property was suppose to place the input label (question name) inside the input boxes.


The code I provided above works with password fields but the rest of the form fields are filled with some funny codes. It will be great for someone to improve on it.

Mohammad
Mohammad Jun 3 '14
@Ebenezer

Daisy is right

right way to add placeholder is using addAttribute()

if you want placeholder then just do something like this $foo->addAttribute('placeholder', 'foo');

Ebenezer Obasi
Ebenezer Obasi Jun 5 '14
Thanks Mohammad. Daisy, my apologies, you are a genius :)
Mohammad
Mohammad Dec 23 '14
Daisy just gave the solution !!! What you need then ?