Re: Achor validation

Johan Brichau <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.squeak.seaside
Message-ID <[email protected]>
Maarten,

What do you mean with ‘validation’ ? What do you want to validate?

The download attribute only tells the browser to download the url contents rather than open it in the browser [1]

If you want to produce the contents of the file from within Seaside, you will need to control the response in the callback, rather than execute an ‘action’.
The return value of an action callback is never what Seaside answers to the browser. This is what you seem to expect in your code snippet.

You need something like:
	callback:[ self requestContext respond: [:response | self writeYourFileOnTheResponse: response ] ]
You can also check it here: http://book.seaside.st/book/fundamentals/forms/fileupload <http://book.seaside.st/book/fundamentals/forms/fileupload>

Mind that #callback: sets (and overwrites) the href attribute on the anchor.
That means the first statement that sets the href manually does not have any effect (and is, in fact, not correct).
If you want to put a href manually, use #url: 

Hope this helps
Johan

[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes>

> On 30 Apr 2019, at 18:24, Maarten Mostert <[email protected]> wrote:
> 
> Hello,
> 
> Is there something inside that allows me to trigger a smalltalk action as a validation before anything else.
> 
> I do something like this:
> 
> (html anchor)
> 							attributeAt: 'href' put: ’Somefile' ;
> 							class: 'pure-button pure-button-primary';
> 							attributeAt: 'download' put:  ’some download file';
> 							callback: [self  getInventoryFile];
> 							with: 
> 									[(html tag: 'i')
> 										class: 'fas fa-download';
> 										style: 'font-size: 14px;'.
> 									html space.
> 									html space.
> 									html text: 'Download counter’]
> 
> The callback is not executed now as the anchor directly responds to the download attribute.
> 
> Thanks in advance.
> 
> Maarten
> _______________________________________________
> seaside mailing list
> [email protected]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[email protected]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.