Re: a simple form confirmation before commit instance to database

53 views
Skip to first unread message

Shawn Milochik

unread,
May 6, 2013, 5:18:20 PM5/6/13
to django...@googlegroups.com
That feels like the wrong place to do it. The simplest thing would be to just pop up a JavaScript dialog that intercepts the form POST, and ask then.

This does exactly what you want with the exception that it'll ask them whether or not the form is valid, but I think that's irrelevant.

If you do it in JavaScript before submitting the form then your Python code stays cleaner. Plus, if you did rig up some hideous hack that worked as described in the original question, you'd suffer any time you tried to write code that imported or used this form -- including unit tests.

Radomir Wojcik

unread,
May 7, 2013, 9:04:51 PM5/7/13
to django...@googlegroups.com
Thanks I'll stick to simple JavaScript here.

张超

unread,
Jan 19, 2016, 12:58:53 AM1/19/16
to Django users


在 2013年5月8日星期三 UTC+8上午9:04:51,Radek Wojcik写道:
Thanks I'll stick to simple JavaScript here.

I also come around the similar question !My js didn't work! I want see you js code!Thanks !
Reply all
Reply to author
Forward
0 new messages