Buy Sell Discuss UK Domain Names at AcornDomains.co.uk

Today's Drop Dates are: 19-02-2012 or 26-02-2012   All times are GMT. The time now is 12:44:19 PM.
Domain Name Sales Domain Software Calculate UK Domain Drop Dates Domain Registration NameDrive Domain Parking Subscribe to our Domains For Sale newsletter
Go Back   Domain Forum Acorn Domains Buy Sell Auction UK Domains > Website Design and Promotion > Website Design > Scripts and Coding
Connect with Facebook

Scripts and Coding PHP, MySQL, scripts

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 27-02-2011, 02:18:10 PM     #1 (permalink)

 
Join Date: Jun 2010
Posts: 481
theonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond repute

help, text area on forms

I'm using the following to set up the input fields in my form:

<input class="form2" onfocus="this.select()" onblur="this.value=!this.value?'Mobile'his.value ;" onclick="this.value='';"/ type="text" name="mobile" size="24" style="color:#888;"
value="Mobile" />

This displays what to enter in the field (eg. name, mobile), which then disappears on click and comes back if nothing is entered and the user clicks outside of the box. The 'value=""' attribute is needed otherwise no text appears in the input fields from page load, only once a user has clicked in and out of the field.

I have a text area at the bottom of my form which I want to behave in the same manner. I can get it to display the default text I want when the user has clicked in and out of the box, but not from page load. I've added the value attribute but it doesn't make any difference..

Can anyone help? The code I'm using for the text area is as follows:

<textarea class="form2" onfocus="this.select()" onblur="this.value=!this.value?'Description (50 words max)'his.value;" onclick="this.value='';"/ rows="9" style="color:#888" name="message" cols="30" value="Description (50 words max)"></textarea>
theonemanyuri is offline  
Old 27-02-2011, 02:20:52 PM     #2 (permalink)

 
Join Date: Jun 2010
Posts: 481
theonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond repute

Replace the thanks icons with ': t h' (no spaces).. bloody emoticons
theonemanyuri is offline  
Old 27-02-2011, 04:40:08 PM     #3 (permalink)

 
Ashton's Avatar
 
Join Date: Feb 2010
Location: South Coast
Posts: 1,518
Ashton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond repute

Its because textarea works differently - The contents are originally declared by whats inbetween <textarea> and </textarea>

Code:
<textarea class="form2" onfocus="this.select()" onblur="this.value='Description (50 words max)'" onclick="this.value=''"/ rows="9"  cols="30" value="">Description (50 words max)</textarea>
However this isn't a very efficient way of clearing a form to be honest, what you should do is check if they have entered anything within the form and not clear it if they have:

Code:
<textarea class="form2" onfocus="this.value=''" onblur="if(this.value=='')this.value='Description (50 words max)';" rows="9"  cols="30" value="">Description (50 words max)</textarea>
I also moved the value clearing to onfocus - If a user uses there keyboard to navigate to the field (pressing tab) then it will now clear.

Last edited by Ashton; 27-02-2011 at 04:50:58 PM.
Ashton is offline  
Old 27-02-2011, 06:30:03 PM     #4 (permalink)

 
Join Date: Jun 2010
Posts: 481
theonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond reputetheonemanyuri has a reputation beyond repute

Cheers mate works a charm
theonemanyuri is offline  
Old 27-02-2011, 06:59:49 PM     #5 (permalink)

 
Ashton's Avatar
 
Join Date: Feb 2010
Location: South Coast
Posts: 1,518
Ashton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond reputeAshton has a reputation beyond repute

No worries
Ashton is offline  
Closed Thread



Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Domain Name Community Replies Last Post
My free online web forms builder immediate Website Reviews 0 24-05-2010 10:19:22 AM
missing text problem Reg Wharf Scripts and Coding 2 17-03-2010 11:15:44 PM
White text on homepage Frenchiexno1 Search Engine Optimisation 10 10-04-2009 07:26:13 PM
Update MySQL from a text file admin Scripts and Coding 10 15-06-2008 10:09:21 PM

75% off Domains at Network Solutions®.


All times are GMT. The time now is 12:44:19 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0 RC 2
All content on Acorn Domains is member generated and is not moderated before posting. All content is viewed and used by you at your own risk and AD does not warrant the accuracy or reliability of any of the information. The views expressed are those of the individual contributors and not necessarily those of AD. Please contact us to report any issues or send a PM to "Admin".