Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-05-2012, 04:31 AM   PM User | #1
AA Haider
New to the CF scene

 
Join Date: Oct 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
AA Haider is an unknown quantity at this point
Html datalist does not work?

Dear Friends,
I Hope you are all fine.
Friends,Here is a problem in HTML datalist,it does not work in
old browsers.What did can I do for fix this problem.Here is a code.
Code:
<body>
<label>What is your favorite color? <input name="color" type="text" list="html-colors"/>
   <datalist id="html-colors">
      <option value="black">Black</option>
      <option value="blue">Blue</option>
      <option value="white">White</option>
      <option value="yellow">Yellow</option>
   </datalist>
</label>
</body>
AA Haider is offline   Reply With Quote
Old 10-05-2012, 08:56 AM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,697
Thanks: 5
Thanked 875 Times in 850 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
See, that’s why HTML 5 is called a “working draft” and not “official recommendation”. One solution would be to use a select rather than a text input with datalist. After all, I don’t see the point anyway, to use a text input when the answers are a fixed set of options already.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 10-05-2012, 12:02 PM   PM User | #3
AA Haider
New to the CF scene

 
Join Date: Oct 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
AA Haider is an unknown quantity at this point
I can not understand what are you saying?
AA Haider is offline   Reply With Quote
Old 10-05-2012, 12:31 PM   PM User | #4
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,697
Thanks: 5
Thanked 875 Times in 850 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
I’m saying:

Code:
<label>What is your favorite color?
   <select name="colors">
      <option value="black">Black</option>
      <option value="blue">Blue</option>
      <option value="white">White</option>
      <option value="yellow">Yellow</option>
   </select>
</label>
And by the way: A form control (input/select/textarea) must always be inside a form.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 10-05-2012, 12:49 PM   PM User | #5
AA Haider
New to the CF scene

 
Join Date: Oct 2012
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
AA Haider is an unknown quantity at this point
This is not my question
I say that here is a code which is work well in google chrome and firfox
new version but it can not work in IE or firfox old version.
This is a code.
Code:
<!doctype html>
<html>
<head>
<title>Example 0</title>
</head>

<body>

<p>
<form>
<label>What is your favorite color?
      <input type="text" list="colors" />
   <datalist id="colors">
      <option value="black">Black</option>
      <option value="blue">Blue</option>
      <option value="white">White</option>
      <option value="yellow">Yellow</option>
   </datalist>
</label>
</form>
</p>

</body>
</html>
Please solve this problem.
AA Haider is offline   Reply With Quote
Old 10-05-2012, 01:20 PM   PM User | #6
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,697
Thanks: 5
Thanked 875 Times in 850 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
I’m sorry, the code I provided is the solution which works in all browsers. What you have is HTML 5 which is not an official standard (yet) and, as you see, obviously not supported in all major browsers. And even if this solution doesn’t satisfy you, there is no reason to raise your voice like that because pushing buttons makes people even less willing to help you.

So, again: go with a select element and you’re all safe. As I said, there is no point in using a datalist in this context if the option are given anyway.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Users who have thanked VIPStephan for this post:
AA Haider (10-05-2012)
Reply

Bookmarks

Tags
datalist, html, html5

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:47 AM.


Advertisement
Log in to turn off these ads.