At first I thought this was a cross-browser issue of Prototype when
Form.Element.present() used on a select box returned "true" on Firefox
but not on IE when a non-empty OPTION field was selected.

Later then, I realized that this method was in fact just meant for
text inputs (as clearly stated in the documentation: "Returns true if
a text input has contents, false otherwise.").

Still, I think it would be nice to have the functionality of the
Form.Element.present method extended so that the following example
would work on all browsers the way I thought it would at first
("false" when no or the empty option is selected, "true" otherwise):


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
  <head>

    <title>Test</title>
    <script type="text/javascript" src="prototype.js"></script>
    <script type="text/javascript">
    document.observe("dom:loaded", function () {
      $("mySelect").observe("change", function () {
        alert($("mySelect").present() ? "select set" : "select not
set")
      });
    });
    </script>

  </head>
  <body>

    <select id="mySelect">
      <option></option>
      <option>test</option>
    </select>

  </body>
</html>


What do you think?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to