Hi all,

I wonder if I could get your help on this.  I am a total of 2 weeks
into learning javascript/AJAX so I don't have a lot of knowledge yet.
I've got a <div> that won't update "IF" I place my js in a separate js
file.  The returned response is placed in a new window.  This
behaviour is true of both IE7 and FireFox 2.x.  The first block of
HTML/Javascript works and updates the <div id='myResults'> tab.  The
second block example does not.  Can anyone tell me why?  Thanks!!!

tm

Works!
[CODE]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/
>
    <title>Search Log Portal</title>
                <script type="text/javascript" src="prototype.js"></script>
                <link rel="stylesheet" type="text/css" href="search_style.css" 
/>
</head>

<body>

<div style="text-align: center"><IMG SRC="slueth1.jpg" width="85"
height="125" alt="Slueth" border="0"></div>
<div id="header" align="center">Syslog Search</div>

<div id='container'> <!--- Begin Container --->
<p align="center">
<div class="bar">&nbsp;</div>
        <div class="panel" id="standard">
                <form action="/cgi-bin/search.rb" id="search-form" method="get"
onsubmit="new Ajax.Updater('myResults', '/cgi-bin/search.rb',
{asynchronous:true, parameters:Form.serialize(this)}); $('search-
form').reset(); return false;">
                <fieldset>
                        <legend>Select</legend>
                                <div class="form-row">
                                        <SELECT NAME="logtype" size="1">
                                                <option 
value="DHCP">DHCP</option>
                                                <option 
value="spam">Spam</option>
                                                <option 
value="smtp">SMTP</option>
                                                <option 
value="mail">Mail</option>
                                                <option value="mx">MX</option>
                                        </SELECT>
                                </div>
                                <div class="form-row">
                                        <div class="field-label"><label 
for="field1">Search</label>:</
div>
                                        <div class="field-widget"><input 
name="search" /></div>
                                </div>
                                <div class="form-row">
                                        <div class="field-label"><label 
for="field2">Type</label>:</div>
                                        <div class="field-label">
                                                        <input type="radio" 
name="method" id="CAT" value="CAT" checked /
>History
                                                        <input type="radio" 
name="method" id="TAIL" value="TAIL" /
>Active
                                        </div>
                                </div>
                </fieldset>
                <input type="submit" id='submit-button' value="Start Search" />
    </form>
                <div id="myResults"> </div>
        </div>
</div> <!--- End container --->

</body>
</html>
[/CODE]

Does No Work
[CODE]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/
>
    <title>Search Log Portal</title>
                <script type="text/javascript" src="prototype.js"></script>
                <script type="text/javascript" src="myajax.js"></
script>
                <link rel="stylesheet" type="text/css" href="search_style.css" 
/>
</head>

<body>

<div style="text-align: center"><IMG SRC="slueth1.jpg" width="85"
height="125" alt="Slueth" border="0"></div>
<div id="header" align="center">Syslog Search</div>

<div id='container'> <!--- Begin Container --->
<p align="center">
<div class="bar">&nbsp;</div>
        <div class="panel" id="standard">
                <form id="search-form" >
                <fieldset>
                        <legend>Select</legend>
                                <div class="form-row">
                                        <SELECT NAME="logtype" size="1">
                                                <option 
value="DHCP">DHCP</option>
                                                <option 
value="spam">Spam</option>
                                                <option 
value="smtp">SMTP</option>
                                                <option 
value="mail">Mail</option>
                                                <option value="mx">MX</option>
                                        </SELECT>
                                </div>
                                <div class="form-row">
                                        <div class="field-label"><label 
for="field1">Search</label>:</
div>
                                        <div class="field-widget"><input 
name="search" /></div>
                                </div>
                                <div class="form-row">
                                        <div class="field-label"><label 
for="field2">Type</label>:</div>
                                        <div class="field-label">
                                                        <input type="radio" 
name="method" id="CAT" value="CAT" checked /
>History
                                                        <input type="radio" 
name="method" id="TAIL" value="TAIL" /
>Active
                                        </div>
                                </div>
                </fieldset>
                <input type="submit" id='submit-button' onclick="doSearch()"
value="Start Search" />
    </form>
                <div id="myResults"> </div>
        </div>
</div> <!--- End container --->

</body>
</html>
[/CODE]
function doSearch(){
                                new Ajax.Updater('myResults', 
'/cgi-bin/search.rb',
{asynchronous:true, parameters:Form.serialize(this)});
                                $('search-form').reset();
                        }
[CODE]

[/CODE]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to