Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

widget works once, then never again (until you cmd+r)



Hey there,
Pretty new to writing widgets.
The widget i'm working uses curl to hit a webpage and get back the content.
I was using synchronous method before, but then that didn't work. Apple docs didn't mention why, so i try asynchronous and that worked.
But now once it does the curl, data gets returned and the correct div gets updated. As soon as you try to do another search/curl the div goes blank and the widget becomes non-functional until you cmd+r it.


Any ideas?

here's the js that gets called:

function doSearch() {

    if (window.widget) {

var myWidget = widget.system('/usr/bin/curl http://localhost/ ~mm/dashboardsearch.php?name=' + document.getElementById('search- input').value,endHandler);
myWidget.onreadoutput = outputHandler;


    }

}

function endHandler(s) {
    alert("calling myWidget.close();");
    s.cancel();
}

function outputHandler (s) {

    document.getElementById('searchresults').innerHTML += s;

}



Also,
I verified that the webpage doesn't get hit the second time by looking at the httpd-access log.
Here's the html:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd";>

<html>
<meta http-equiv="content-type" content="text/html; charset=utf-8">

<head>

<style>
    body {
        margin: 0;
        background-image: url(Default.png);
        background-repeat: no-repeat;
        background-position: left top;
        background-attachment: scroll;
    }
    .helloText {
        font: 10px "Helvetica";
        font-weight: bold;
        color: white;
        text-align: center;
        position: absolute;
        top: 16px;
        left: 18px;
        width: 180px;
        height: 20px;

    }

    .searchresults {
        font: 10px "Helvetica";
        font-weight: bold;
        color: black;
        text-align: left;

    }
</style>
<script src="employeesearch.js" type="text/javascript"></script>
</head>

<body>
<form name="myform" onsubmit="javascript:doSearch();">

<div class="helloText">TBWA\Chiat\Day Employee Search
<div style="padding-top:2px;"><input type="search" id="search-input" placeholder="Enter name" style="width: 140px;"><input type="submit" value="go"></div>
<div id="searchresults" style="height: 230px;overflow:scroll;width:207px;display:inline;visibility: visible;z-index;1;"></div>
</div>
</div>


</FORM>
</body>
</html>

THANKS!
Mark


_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.