librelist archives

« back to archive

Can we use Flask-WTF validation in Ajax based dialog forms?

Can we use Flask-WTF validation in Ajax based dialog forms?

From:
Eko S.Wibowo
Date:
2013-11-10 @ 21:40
Hi there,

I have become so acquainted in using Flask-WTF to do input validation
in my web form. But another question arise, can I use its validations
functionalities in an ajax dialog based?

That is, sending a post request by ajax, upon returning its result we
can give user visual feedback on the validation process? Hm, I think
it will be some sort of Client Side validation.. or kind of :)

Thanks!

-- 
Eko S. Wibowo
----------------------
http://about.me/ekowibowo
*Building my own company*

Re: [flask] Can we use Flask-WTF validation in Ajax based dialog forms?

From:
gioi
Date:
2013-11-11 @ 13:31
Yes, you can, but I think you should use *both* client-side (to give
immediate feedback) and server-side (never trust the sender).
Unfortunately, I don't think that a client-side bridge even exists.
You'll have to code the frontend and probably write validation rules
twice, but I'm pretty sure you can.
That's not much, but HTH.

Re: [flask] Can we use Flask-WTF validation in Ajax based dialog forms?

From:
Daniel Fairhead (ict)
Date:
2013-11-11 @ 14:16
If you wanted to be super amazing, you could make a library which 
auto-generated client-side jquery form validation code from the wtf-forms 
rules, and sent it as javascript, then you'd have a real winner. :-)

On 11 Nov 2013, at 13:31, gioi wrote:

> Yes, you can, but I think you should use *both* client-side (to give
> immediate feedback) and server-side (never trust the sender).
> Unfortunately, I don't think that a client-side bridge even exists.
> You'll have to code the frontend and probably write validation rules
> twice, but I'm pretty sure you can.
> That's not much, but HTH.
>
>


  OM International Services (Carlisle) Ltd - Unit B Clifford Court, Cooper
Way - Carlisle CA3 0JG - United Kingdom
  Charity reg no: 1112655 - Company reg no: 5649412 (England and Wales)

Re: [flask] Can we use Flask-WTF validation in Ajax based dialog forms?

From:
Eko S.Wibowo
Date:
2013-11-11 @ 22:09
thanks all!
A client side bridge library for flask-wtf.... seems promising
Although I am pretty surprise this library didn't exist..yet :)

Thanks!

-- 
Eko S. Wibowo
----------------------
http://about.me/ekowibowo
*Building my own company*