Re: [Hobo Users] Field help text and placeholder

41 views
Skip to first unread message

Bryan Larsen

unread,
Feb 27, 2013, 9:28:01 AM2/27/13
to hobo...@googlegroups.com
In your DRYML, you can do something like this. This assumes that you
are using the bootstrap theme.

<field-list: fields="name, email_address, password,
password_confirmation">
<name-view:><input placeholder="FOO"/></name-view:>
<name-help:>HELP for name</name-help:>
</field-list:>

I pushed a small bugfix for hobo_bootstrap, so make sure you're
running version 1.0.0 of hobo_bootstrap, not a prerelease. You may
need to get it from github, depending on how soon you get this email.

Bryan


On Mon, Feb 25, 2013 at 3:53 PM, Tamer Sherif <tamers...@gmail.com> wrote:
> Can someone please help me figure out how to add placeholder text to a field
> inside a model, and I want to add some kind of help text beside or under the
> field as well?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to hobousers+...@googlegroups.com.
> To post to this group, send email to hobo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hobousers?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Tamer Sherif

unread,
Dec 3, 2013, 4:50:36 PM12/3/13
to hobo...@googlegroups.com
Thank you Bryan, the placeholder worked. However the help text didn't.
My code looks like this:

<field-list: columns="3" skip="owner, registration_status, payment_received" >
    <name-view:><input placeholder="FOO"/></name-view:> 
            <name-help:>HELP for name</name-help:>
    <name-label:>Full Name</name-label:>
    </field-list:>

Do you happen to know why? I would like to display a help text under the field

Ignacio Huerta

unread,
Dec 3, 2013, 5:19:26 PM12/3/13
to hobo...@googlegroups.com
Hi Tamer,

Please try adding the help string to config/locales/app.en.yml. For example:

en:
activerecord:
attribute_help:
user:
name: HELP for name

Regards,
Ignacio

El 03/12/13 22:50, Tamer Sherif escribi�:
> > email to hobousers+...@googlegroups.com <javascript:>.
> > To post to this group, send email to hobo...@googlegroups.com
> <javascript:>.
> <http://groups.google.com/group/hobousers?hl=en>.
> > For more options, visit https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>.
> >
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hobousers+...@googlegroups.com.
> To post to this group, send email to hobo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35
Email realizado con software libre

Tamer Sherif

unread,
Dec 4, 2013, 2:10:32 AM12/4/13
to hobo...@googlegroups.com
Thank you Ignacio. Indeed it worked. Do you know how can I style the help text?
For example I want it to be: HELP for name (bold)

I tried doing it like this:
- name: "<strong>HELP</strong> for name"
- name: <strong>HELP</strong> for name
but no luck!


On Wed, Dec 4, 2013 at 12:19 AM, Ignacio Huerta <ign...@ihuerta.net> wrote:
Hi Tamer,

Please try adding the help string to config/locales/app.en.yml. For example:

en:
  activerecord:
    attribute_help:
      user:
        name: HELP for name

Regards,
Ignacio

El 03/12/13 22:50, Tamer Sherif escribió:
Teléfono: 0034 645 70 77 35

Email realizado con software libre

--
You received this message because you are subscribed to a topic in the Google Groups "Hobo Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hobousers/SOtqKDgrl-I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hobousers+...@googlegroups.com.

To post to this group, send email to hobo...@googlegroups.com.
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.



--
Regards,
Tamer Sherif Joseph

Ignacio Huerta

unread,
Dec 6, 2013, 1:08:02 PM12/6/13
to hobo...@googlegroups.com
Hi Tamer,

You are welcome :). Adding HTML in the I18n files is not going to work
very well. You could edit the forms HTML with Dryml, but it will be much
easier to do this with CSS. You can use firebug or similar inspector
tools to navigate the code and then write your CSS. For example:

form .name-help{
font-weight: bold;
}

Regards,
Ignacio

El 04/12/13 08:10, Tamer Sherif escribi�:
> Thank you Ignacio. Indeed it worked. Do you know how can I style the
> help text?
> For example I want it to be: *HELP* for name (bold)
>
> I tried doing it like this:
> - name: "<strong>HELP</strong> for name"
> - name: <strong>HELP</strong> for name
> but no luck!
>
>
> On Wed, Dec 4, 2013 at 12:19 AM, Ignacio Huerta <ign...@ihuerta.net
> <mailto:ign...@ihuerta.net>> wrote:
>
> Hi Tamer,
>
> Please try adding the help string to config/locales/app.en.yml. For
> example:
>
> en:
> activerecord:
> attribute_help:
> user:
> name: HELP for name
>
> Regards,
> Ignacio
>
> El 03/12/13 22:50, Tamer Sherif escribi�:
> <tamers...@gmail.com <mailto:tamers...@gmail.com>
> > <javascript:>> wrote:
> > > Can someone please help me figure out how to add placeholder
> text
> > to a field
> > > inside a model, and I want to add some kind of help text
> beside or
> > under the
> > > field as well?
> > >
> > > --
> > > You received this message because you are subscribed to the
> Google
> > Groups
> > > "Hobo Users" group.
> > > To unsubscribe from this group and stop receiving emails
> from it,
> > send an
> > > email to hobousers+...@googlegroups.com
> <mailto:hobousers%2B...@googlegroups.com> <javascript:>.
> > > To post to this group, send email to
> hobo...@googlegroups.com <mailto:hobo...@googlegroups.com>
> > <javascript:>.
> > > Visit this group at
> http://groups.google.com/group/hobousers?hl=en
> > <http://groups.google.com/group/hobousers?hl=en>.
> > > For more options, visit https://groups.google.com/groups/opt_out
> > <https://groups.google.com/groups/opt_out>.
> > >
> > >
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Hobo Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to hobousers+...@googlegroups.com
> <mailto:hobousers%2Bunsu...@googlegroups.com>.
> > To post to this group, send email to hobo...@googlegroups.com
> <mailto:hobo...@googlegroups.com>.
> > Visit this group at http://groups.google.com/group/hobousers.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> Ignacio Huerta Arteche
> http://www.ihuerta.net
> Tel�fono: 0034 645 70 77 35
> Email realizado con software libre
>
> --
> You received this message because you are subscribed to a topic in
> the Google Groups "Hobo Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/hobousers/SOtqKDgrl-I/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> hobousers+...@googlegroups.com
> <mailto:hobousers%2Bunsu...@googlegroups.com>.
> To post to this group, send email to hobo...@googlegroups.com
> <mailto:hobo...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> Regards,
> Tamer Sherif Joseph
>
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hobousers+...@googlegroups.com.
> To post to this group, send email to hobo...@googlegroups.com.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

--
Ignacio Huerta Arteche
http://www.ihuerta.net
Tel�fono: 0034 645 70 77 35

Tamer Sherif

unread,
Dec 7, 2013, 3:33:51 AM12/7/13
to hobo...@googlegroups.com, hobo...@googlegroups.com
Will do that, thanks again!

Sent from my iPhone
Tamer

On Dec 6, 2013, at 8:08 PM, Ignacio Huerta <ign...@ihuerta.net> wrote:

Hi Tamer,

You are welcome :). Adding HTML in the I18n files is not going to work
very well. You could edit the forms HTML with Dryml, but it will be much
easier to do this with CSS. You can use firebug or similar inspector
tools to navigate the code and then write your CSS. For example:

form .name-help{
 font-weight: bold;
}

Regards,
Ignacio

El 04/12/13 08:10, Tamer Sherif escribió:

Thank you Ignacio. Indeed it worked. Do you know how can I style the
help text?
For example I want it to be: *HELP* for name (bold)

I tried doing it like this:
- name: "<strong>HELP</strong> for name"
- name: <strong>HELP</strong> for name
but no luck!


On Wed, Dec 4, 2013 at 12:19 AM, Ignacio Huerta <ign...@ihuerta.net
<mailto:ign...@ihuerta.net>> wrote:

   Hi Tamer,

   Please try adding the help string to config/locales/app.en.yml. For
   example:

   en:
     activerecord:
       attribute_help:
         user:
           name: HELP for name

   Regards,
   Ignacio

   El 03/12/13 22:50, Tamer Sherif escribió:
   Teléfono: 0034 645 70 77 35
Teléfono: 0034 645 70 77 35

Email realizado con software libre

--
You received this message because you are subscribed to a topic in the Google Groups "Hobo Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hobousers/SOtqKDgrl-I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hobousers+...@googlegroups.com.

Tim Griffin

unread,
Dec 12, 2013, 8:39:02 AM12/12/13
to hobo...@googlegroups.com
Tamer;

Including HTML in the I18n files can work, but you have to use html_safe when rendering it:

Example:
app.en.yml:

user:
  no_credit_card: 'You do not have a credit card registered in your profile. You can add one by clicking <a href="/users/%{user_id}">here</a>.'

And, when rendering that message:

  flash[:error] = I18n.translate("user.no_credit_card", :user_id => self.id.to_s).html_safe

Tim
Reply all
Reply to author
Forward
0 new messages