<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Georgia">Ah, yes, thanks. I understand the way to do
this with a #load, </font>but the total replacement was eluding
me. I've never quite grasped the non-symmetrical parts of
seaside/jQuery/whatever.<br>
<br>
If, as you say, I want to replace the *contents* of something, this
works well:<br>
<pre>onClick: ((html jQuery id: #bob002) load html: [:h | h render: Time now asString]);</pre>
But if I want to replace the thing entirely, it seems I need to do
something more complicated:<br>
<pre>onClick: ((html jQuery ajax script:[:s | s << ((s jQuery id: #bob002) replaceWith: [:h | h text: Time now asString])]);</pre>
I keep expecting the two bits of code to differ only in one word,
but that's just me. ;-)<br>
<br>
Anyway, thanks for untangling me.<br>
<br>
Cheers,<br>
Bob<br>
<br>
On 9/18/10 10:27 AM, Johan Brichau wrote:
<blockquote
cite="mid:44EF1646-944D-49E4-9756-4F2482DA28D5@inceptive.be"
type="cite">The script you pass on to onClick has many strange
things. It seems you are trying to render a script as an ajax
response.
<div>Seaside (and jQuery) have exactly what you need. Here's what
you are probably trying to do:</div>
<div><br>
</div>
<div>onClick: ((html jQuery ajax script:[:s | s << ((s
jQuery id: #bob002) replaceWith: [:h | h div with: Time now
asString])]);</div>
<div><br>
</div>
<div>The above will attach a handler script to the onClick event,
that loads and executes a script that replaces the second div
with a new div.</div>
<div>However, you probably only want the internals of the div to
be replaced. This script does exactly that:</div>
<div>
<div><br>
</div>
<div>onClick: ((html jQuery id: #bob002) load html: [:h | h
render: Time now asString]);</div>
<div><br>
</div>
<div>The above will attach a handler script to the onClick
event, that does an ajax html load to replace the contents of
the second div with the time at which the click happened.</div>
<div>
<div><br>
<div>
<div>
<div>On 18 Sep 2010, at 15:19, Bob Arning wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div bgcolor="#ffffff" text="#000000"> <font
face="Georgia">Hi,<br>
<br>
I'm trying to figure out how to use #replaceWith:.
After many permutations, still no-go. :-(<br>
<br>
I want to render 2 divs. When the first is
clicked, I want to replace the second with
something else. Any suggestions?<br>
<br>
renderContentOn: html<br>
<br>
html div<br>
style: 'height: 44px; width: 65px;
background-color: red;';<br>
id: 'bob001';<br>
onClick: (html jQuery ajax html: [ :h |<br>
h render: ((h jQuery id: #bob002)
replaceWith: Time now asString).<br>
]);<br>
with: [html text: 'bob001'].<br>
html div<br>
style: 'height: 44px; width: 65px;
background-color: green;';<br>
id: 'bob002';<br>
with: [html text: 'bob002'].<br>
<br>
TIA,<br>
Bob<br>
</font> </div>
_______________________________________________<br>
seaside mailing list<br>
<a moz-do-not-send="true"
href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
seaside mailing list
<a class="moz-txt-link-abbreviated" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a>
<a class="moz-txt-link-freetext" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a>
</pre>
</blockquote>
</body>
</html>