[Seaside] JS - onclick="return confirm('Are you sure?')"

Johan Brichau johan.brichau at uclouvain.be
Fri Feb 26 12:15:27 UTC 2010


Hi John,

I don't think there is anything wrong with passing the javascript as a string. 
In fact, for your example, this is what I would prefer.

I see the JS api as a very convenient way to script dynamically generated javascript together. Things like:

(JSStream on: 'somecondition') 
	then: (html jQuery ajax callback: [ ...executed ST callback when JS someCondition is true ...]
	else: (html jQuery ajax callback: [ ... executed ST callback when JS someCondition is true ...]

But for anything that can be statically specified, my preference goes to either external java scripts files or simply using literal strings and the JSStream.

best regards,
Johan

On 25 Feb 2010, at 12:35, John Thornborrow wrote:

> Hi all,
> 
> I'm loving the new JS api, however when I try to achieve the above in an
> #onClick: event, it is proving difficult to do so via the javascript API.
> 
> I'm probably missing something, but it seems the only way to do so, is
> to use a literal string, e.g.:
> 
> html button
>  type: 'submit';
>  onClick: 'return confirm(''Are you sure?'')';
>  callback: [self doSomething];
>  text: 'Click me!!1'
> 
> I've tried with various #confirm: sends, and the nearest I can get is:
> 
> (html javascript return: true)
>    confirm: 'Are you sure?'
> 
> But this prints:
> 
>   if(confirm('Are you sure?')){return true}
> 
> Which, as it doesn't have a "false" path, means it will always submit.
> 
> Am I missing anything? :)
> 
> 
> 
> 
> Consider your responsibility to the environment - think before you print! 
> 
> ******************************************************************************************************************************************
> This email is from Pinesoft Limited. Its contents are confidential to the intended recipient(s) at the email address(es) to which it has been addressed. It may not be disclosed to or used by anyone other than the addressee(s), nor may it be copied in anyway. If received in error, please contact the sender, then delete it from your system. Although this email and attachments are believed to be free of virus, or any other defect which might affect any computer or IT system into which they are received and opened, it is the responsibility of the recipient to ensure that they are virus free and no responsibility is accepted by Pinesoft for any loss or damage arising in any way from receipt or use thereof. *******************************************************************************************************************************************
> 
> 
> Pinesoft Limited are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

----------------------------
Johan Brichau
johan.brichau at uclouvain.be






More information about the seaside mailing list