[Seaside] Re: I would like to attach an onClick event according to

Fritz Schenk intrader.intrader at gmail.com
Fri Feb 4 17:42:09 UTC 2011


Robert, even with the mess I made of the quotes, your code does not work.
I suspect that the way Seaside handles quote is incorrect (see the 'generated 
source' below).
<your code>
renderContentOn: html 
	
"From Robert Sirois with id corrections and at 'You are'..."
1 to: 5 do: [:x |
html div
id: 'external_links';
with: [
html anchor
callback: [ x inspect ];
with: x
].
].

1 to: 5 do: [:x |
html div
id: 'external_links';
with: 'just some content'
].

html button
onClick: ((html jQuery expression: '#external_links a') onClick: 'return 
confirm("You are going to visit: "+ this.href)');
with: 'Attach Click'.
</your code>
<generated source>
<div id="external_links">
  <a href="/whatever?_s=LG3lfxc-9JRlLsd5&_k=IrWB5OCYShO7CscD&6">1</a>
</div>
<div id="external_links">
  <a href="/whatever?_s=LG3lfxc-9JRlLsd5&_k=IrWB5OCYShO7CscD&7">2</a>
</div>
<div id="external_links">
  <a href="/whatever?_s=LG3lfxc-9JRlLsd5&_k=IrWB5OCYShO7CscD&8">3</a>
</div>
<div id="external_links">
  <a href="/whatever?_s=LG3lfxc-9JRlLsd5&_k=IrWB5OCYShO7CscD&9">4</a>
</div>
<div id="external_links">
  <a href="/whatever?_s=LG3lfxc-9JRlLsd5&_k=IrWB5OCYShO7CscD&10">5</a>
</div>
<div id="external_links">just some content</div>
<div id="external_links">just some content</div>
<div id="external_links">just some content</div>
<div id="external_links">just some content</div>
<div id="external_links">just some content</div>
<button onclick="$("#external_links a").click(function(){return confirm("You are 
going to visit: "+ this.href)})" type="submit" class="submit">Attach 
Click</button>
</generated source>

Note the strange way that it has translate quotes - the JavaScript interpreter 
(or compiler) has trouble with the double quotes

The correct code in JavaScript is in http://jsbin.com/imuka5/2

The code I want from the IBM article has the following expression:
<code>
$('#external_links a').click(function() {
    return confirm('You are going to visit: ' + this.href);
});
</code>



More information about the seaside mailing list