[annotator-dev] validate annotation before store it

steph steph at endpoint.com
Thu May 29 16:35:19 UTC 2014


Hi,

I tend to see validation on both the client side and server side 
frequently, and in our use of Annotator, it was requested to have client 
side validation to minimize the server hit for erroneous data.

The only way I've been able to accomplish this is to modify the core by 
prepending in the Editor.submit method. It returns if the validation 
does not pass (doesn't hit the this.hide()) call. I was not able to 
accomplish this without modifying the core. I shared this override in my 
list of modified core notes at 
https://lists.okfn.org/pipermail/annotator-dev/2014-May/000907.html, and 
Randall replied that there is a Editor _onFormSubmit callback that is 
not public. I interpreted his further response that this is still being 
worked on related to the current refactoring.

Steph





On 05/29/2014 09:27 AM, Michael Scharf wrote:
> Hi Riccardo,
>
> checking annotations in the client my be a good idea. But ultimately, 
> it should
> be checked on the server. Because normally you have no control on what 
> is sent
> via the API and only the server site you can make sure the data 
> inserted is
> consistent.
>
> This is actually an interesting case where using different languages 
> in the
> client and in the server makes things more difficult. If the server is 
> node.js
> based, you can do a validity check in the client and do the same check
> on the server...
>
>
> Michael
>
>
> On 2014-05-29 9:41, Riccardo Tasso wrote:
>> I found that's a bug introduced by an extension of mine, so there's 
>> no bug in annotator. Anyway it's still interesting understand if it's 
>> possibile validate an annotation before store it.
>>
>> I tried returning false in the event "annotationCreated" but it 
>> doesn't work.
>>
>> Thanks,
>>     Riccardo
>>
>>
>> 2014-05-29 8:37 GMT+02:00 Riccardo Tasso <riccardo.tasso at gmail.com 
>> <mailto:riccardo.tasso at gmail.com>>:
>>
>>     Hi all, is there a way to check an annotation before it's send to 
>> the store?
>>     I mean, one of my users found a way (I don't know how) to insert 
>> an annotation whose begin is greater than end and I need to avoid the 
>> insertion of those kind of annotations.
>>
>>     Cheers,
>>          Riccardo
>>
>>
>>
>>
>> _______________________________________________
>> annotator-dev mailing list
>> annotator-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/annotator-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
>>
>
>
> _______________________________________________
> annotator-dev mailing list
> annotator-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/annotator-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev




More information about the annotator-dev mailing list