Forms and highlighting text in a field

I’m sure It’s possible to have “Instructional text” in a form field
highlighted as default when the form load so that the user can just start
typing their info and it replaces the default text.

Only I don’t know how, any ideas gratefully received?

Best wishes Peter

================================
Peter Tucker, Oxford UK email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I have an action called ‘Form Element Styler’ which if set up will
change the form field background to a selected colour when the cursor
enters that field and then return it to it’s original colour when the
focus is lost. You can see what I mean on this form:
http://www.easibase.com/easicontact.php

I don’t know of an action to replace default text in a field but I did
find this:
http://www.catchmyfame.com/2009/09/19/form-field-hints-with-jquery/

HTH

On Dec 18, 2009, at 4:34 PM, Peter Tucker wrote:

I’m sure It’s possible to have “Instructional text” in a form field
highlighted as default when the form load so that the user can just
start
typing their info and it replaces the default text.

Only I don’t know how, any ideas gratefully received?

Best wishes Peter

================================
Peter Tucker, Oxford UK email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

If you add the default text as the Value of your field, then you can
use Item / Extended to add the following snip of JavaScript to empty
it out when the field gains focus. Click the New button in the
Extended dialog, and you’ll see a sub-dialog with fields for Name and
Value. Enter these:

onfocus

this.value = (this.value == 'Your default text') ? '' : 'Your default  

text’;

Note that that’s two single typewriter quotes in a row after the
question mark, not one double typewriter quote. You’re setting the
value to the empty string, but you’re doing it within double-quotes
(created by Freeway), so you have to use single-quotes to define the
value.

Walter

On Dec 18, 2009, at 10:34 AM, Peter Tucker wrote:

I’m sure It’s possible to have “Instructional text” in a form field
highlighted as default when the form load so that the user can just
start
typing their info and it replaces the default text.

Only I don’t know how, any ideas gratefully received?

Best wishes Peter

================================
Peter Tucker, Oxford UK email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Oops, stupid error (that would always restore the default value if you
returned to the field a second time). Should be this:

this.value = (this.value == this.defaultValue) ? '' : this.value;

The matching onblur handler to restore the default value if you move
away from the form field without changing the value would be this:

onblur

this.value = (this.value == '') ? this.defaultValue : this.value;

Walter

On Dec 18, 2009, at 11:24 AM, Walter Lee Davis wrote:

this.value = (this.value == ‘Your default text’) ? ‘’ : ‘Your
default text’;


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

on 18/12/2009 16:24, Walter Lee Davis at email@hidden wrote:

If you add the default text as the Value of your field,

Hi W,

Great, thanks I was going to shout because it would not work at first. But I
persisted a bit more and found that the text I’d entered in the Inspector
Text: field had to match exactly the text on the quoted Extended attribute.

Thanks, I’ve a stack of beers here for you when you pop-by ;~}}

then you can
use Item / Extended to add the following snip of JavaScript to empty
it out when the field gains focus. Click the New button in the
Extended dialog, and you’ll see a sub-dialog with fields for Name and
Value. Enter these:

onfocus

this.value = (this.value == ‘Your default text’) ? ‘’ : ‘Your default
text’;

Note that that’s two single typewriter quotes in a row after the
question mark, not one double typewriter quote. You’re setting the
value to the empty string, but you’re doing it within double-quotes
(created by Freeway), so you have to use single-quotes to define the
value.

Walter

On Dec 18, 2009, at 10:34 AM, Peter Tucker wrote:

I’m sure It’s possible to have “Instructional text” in a form field
highlighted as default when the form load so that the user can just
start
typing their info and it replaces the default text.

Only I don’t know how, any ideas gratefully received?

Best wishes Peter

================================
Peter Tucker, Oxford UK email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Best wishes Peter

================================
Peter Tucker, Oxford UK email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

on 18/12/2009 16:40, Walter Lee Davis at email@hidden wrote:

Oops, stupid error (that would always restore the default value if you
returned to the field a second time).

Yea, you’re right!

Should be this:

this.value = (this.value == this.defaultValue) ? ‘’ : this.value;

Yup that works fine now ;~}}

The matching onblur handler to restore the default value if you move
away from the form field without changing the value would be this:

onblur

this.value = (this.value == ‘’) ? this.defaultValue : this.value;

Even better thanks very much ;~}}

Best wishes Peter

================================
Peter Tucker, Oxford UK email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options