• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

html text box issues

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I want to do 2 things with a html text box.

Further information: I am using IE6 and javascript/html

2 things are
1) How do I automatically highlight the text in the textbox when the page loads but leaves the default value?
But the highlight disappears when I type a value into the input html text.
2) My webpage is being refreshed/resubmitted to the server when I have the cursor in the text box.
How do I stop this?

Some code snippets examples would be great?

Thanks in advance.

Regards
Kevin Wong
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when you post code please use the code tag button.

Eric
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) You use select



2) Not sure what you are talking about, what is causing the refresh? You hitting enter?

Eric
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds very complicated. Let's try to construct a text box with text showing default values, it will be focused on loading and it will be vanished when the form is submitted.

1. In order to memorized the default text to differentiate if the user have modified the textbox or not, the default value should not store in the value attribute of the text box. In this case, I choose the rel property as an example.

2. If the user simply press the delete button, that's the same case as if the user input nothing. It's better to display the default value again.

3. Different colour showing default value show be more user friendly, since it alert the user that he hasn't input anything.

4. The form containing the input box should be added with an automatic script for clearing the content of the text box on submit.

5. I've used the class name "jqy-DefaultText" as illustration.

6. For fast development, allow me to use the jQuery library. Actual this code can be written without any library.

I've added all this to the following code:



I've put it online at here
 
this llama doesn't want your drama, he just wants this tiny ad for his mama
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic