jquery ui dialog box always returning false
<p>When u enter text into the input or not the dialog box opens. should only open if no value is found: fiddle = <a href="http://jsfiddle.net/tzxS2/" rel="nofollow">http://jsfiddle.net/tzxS2/</a></p>

<p>code/css/js: does not seem to work in a form:</p>

<pre><code> &lt;form id="dacform" method='get' action='dac' onsubmit="return check_domain_input()" accept-charset='utf-8'&gt;
    &lt;input name='domain' type="text" style="font-size:15px;" class="searchbox"/&gt;
    &lt;select style="background:#f8f8f8; margin-left:4px; font-size:15px;" class="selectlist slight" id="selectdomain" name="tld"&gt;
      &lt;option value=''&gt;( all )&lt;/option&gt;
      &lt;option value="co.uk"&gt;co.uk&lt;/option&gt;
      &lt;option value="me.uk"&gt;me.uk&lt;/option&gt;
      &lt;option value="org.uk"&gt;org.uk&lt;/option&gt;
      &lt;option value="com"&gt;com&lt;/option&gt;
    &lt;/select&gt;
    &lt;input onclick="check_domain_input()" class="btn grey bbig" name="search" type="submit" value="Search" style="width:59px; margin-left:7px; font-size:15px;" /&gt;
    &lt;/form&gt;&lt;br /&gt;
    Our domain registration system is highly automated so we register your domain names fast and secure.

    &lt;div id="dialog" title="Attention!" style="display:none"&gt;
    Please enter a domain name to search for.
    &lt;/div&gt;
&lt;div onclick="check_domain_input()"&gt;Click&lt;/div&gt;

&lt;div id="dialog" title="Attention!" style="display:none"&gt;
    Please enter a domain name to search for.
&lt;/div&gt;

&lt;script&gt;
    function check_domain_input()
    {        
        $( "#dialog" ).dialog(); // Shows the new alert box.

        var domain_val = document.getElementsByName('domain');

        if (domain_val[0].value.length &gt; 0)
        {
            return true;
        }

        $( "#dialog" ).dialog();

        return false;
    }
&lt;/script&gt;
</code></pre>
