Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2009
    Location
    Maryland
    Posts
    65
    Plugin Contributions
    0

    Default How to javascript to display hints on form fields?

    I have looked for over an hour on this forum and had not much sucess, so I had to create a new thread.

    I have a sidebox login and I want hints (email address and password) to appear in the form fields, so customers know what to type in the fields. I know this is done with javascript but don't know where or how to put it in zen cart.

    Any ideas?

    JE

  2. #2
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: How to javascript to display hints on form fields?

    You don't need to use javascript - just populate the entry field with the text you want.
    If you're using the function zen_draw_input_field to draw the entry box, you probably have php code like:
    PHP Code:
    zen_draw_input_field('email_address''''30'
    You can put the text Email Address in there like this:
    PHP Code:
    zen_draw_input_field('email_address''Email Address''30'
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  3. #3
    Join Date
    Jul 2009
    Location
    Maryland
    Posts
    65
    Plugin Contributions
    0

    Default Re: How to javascript to display hints on form fields?

    Quote Originally Posted by bunyip View Post
    You don't need to use javascript - just populate the entry field with the text you want.
    If you're using the function zen_draw_input_field to draw the entry box, you probably have php code like:
    PHP Code:
    zen_draw_input_field('email_address''''30'
    You can put the text Email Address in there like this:
    PHP Code:
    zen_draw_input_field('email_address''Email Address''30'
    Yes! this helps.

    I get the hints on the form fields, but they (the hints) don't disappear when I clicks inside the field. In other words, if the customer is not paying attention and erases the hint, they could type their email after email address hint. so the info being send woul be be email [email protected]. This goes the same for the password. which obviously would cause logging in problems.

    With Javascript, the moment the user click the form field, the hint phrase dissappears.

    Your answer is great, just trying to make it less frustating for customers.

    Could this be done?

  4. #4
    Join Date
    Jul 2009
    Location
    Maryland
    Posts
    65
    Plugin Contributions
    0

    Default Re: How to javascript to display hints on form fields?

    Quote Originally Posted by bunyip View Post
    You don't need to use javascript - just populate the entry field with the text you want.
    If you're using the function zen_draw_input_field to draw the entry box, you probably have php code like:
    PHP Code:
    zen_draw_input_field('email_address''''30'
    You can put the text Email Address in there like this:
    PHP Code:
    zen_draw_input_field('email_address''Email Address''30'
    I just realized the hints now appear everywhere those form fields are located. Is there a way to localized the hint to just the sideboxes?

    Thanks for your help! it's definately appreciated!

  5. #5
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: How to javascript to display hints on form fields?

    You should only be changing the code within the template files where your specific entry fields are being displayed - not in the function file itself. You could use a single javascript to delete the internal field text when the customer clicks within the field.
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  6. #6
    Join Date
    Jul 2009
    Location
    Maryland
    Posts
    65
    Plugin Contributions
    0

    Default Re: How to javascript to display hints on form fields?

    Quote Originally Posted by bunyip View Post
    You could use a single javascript to delete the internal field text when the customer clicks within the field.
    Thanks,

    Yeah I did not realized, I change the core file instead of just the file for the sidebox. Great that's fix.

    Sorry newbie here, but what javascript command and where do I put it?

 

 

Similar Threads

  1. Is there a way to add form field hints for individual attributes?
    By polygone in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 16 Dec 2009, 03:28 AM
  2. How to delete *required fields in registration form?
    By sart in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 1 Apr 2008, 03:02 PM
  3. Modifying the account create to include form field hints
    By davidhwalker in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 30 May 2007, 03:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR