>All Tutorials 
Ajax and .NET Ajax and .NET RSS XML
Ajax and ColdFusion Ajax and ColdFusion RSS XML
Ajax and Java Ajax and Java RSS XML
Ajax and PHP Ajax and PHP RSS XML
Ajax and SOA Ajax and SOA RSS XML
Ajax Goodies Ajax Goodies RSS XML
Ajax Tool Ajax Tool RSS XML
Facebook MockAjax Facebook MockAjax RSS XML
Google Web Toolkit Google Web Toolkit RSS XML
JavaScript Framework JavaScript Framework RSS XML
Ruby on Rails Ruby on Rails RSS XML
Technique Introduction Technique Introduction RSS XML
Without XMLHttpRequest Without XMLHttpRequest RSS XML
Yahoo! UI Yahoo! UI RSS XML

AJAX validation with Django, newforms and MochiKit - form function var return row code input label

 
Registered tutorials: 501
Registered Users: 24391



Rating: 0 out of 0 votes cast


  
Category: JavaScript Framework

Tags Map

accept add adds ajax append bf bferrors bit blog cciwformmixin changed class client code control controlid controlidn controlname create createpollform cssclass curmember dec def defaultformfilter development div django djangonormalisecontrolid domnode edit editpollformname element elements elm enc encodeform err error errorclass errorrow errors escape event existingpoll facebook false field fields filter forceunicode form formfilter formname formnode forms forum function functions handle handler handlers helptext hiddenfields html http id import inarray include initial input inputs insert instance javascript join jquery json jsonencoder konqueror kwargs label len length li lines maxlength method mkinputchangehandler mochikit newforms newpoll node note null obj object opt option options output parentnode part passed path poll pollid polloption polloptionlistfield post push python pythontojson relevant rendering req request return returns row save script show side site splitdatetimewidget standardformclearerror standardformgetformrow string submit suffix summary tagname text textarea textjavascript title today tolowercase toperrors topic type ul validation validationerror validationerrorbottom values var widget widgets work

Keyword Cloud Navigation Map

AJAX validation with Django, newforms and MochiKit

Digg this   Post to del.icio.us

Abstract: This tutorial presents the example code for using Django, newforms and MochiKit to do AJAX validation.

Before we get going, some context: the Christian Camps in Wales web site has a forum system which allows people to create polls. I rewrote this recently to use newforms, mainly to keep up to date with Django, and also to try out some AJAX.

I first had to write a 'Form' subclass which encapsulates the logic for validating and processing the form. As it happens, the form is based on a model 'Poll', but it requires more fields. In particular, this single form is used to create all the PollOption objects that are attached to the Poll. This is handled by a simple textarea field, into which all the options are entered on separate lines. In Django, we implement this using a custom 'Field' that uses the 'Textarea' widget and adds the relevant validation.

Read Full Tutorial...



Reviews:

Rate and Review This Site

No reviews yet


Statistic Information About this Resource:


Total Hits: 747
Unique Hits: 706


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 3.4 3.5 18.2 19 70.6 74.7
Current 2 3 21 22 82 86
Previous 7 7 22 22 100 104
Jul 22 6 6 22 22 0 0
Jul 21 6 6 19 22 121 130
Jul 20 1 1 25 25 82 88
Jul 19 3 3 0 0 86 89
Jul 18 0 0 25 26 0 0
Jul 17 3 3 23 24 107 112
Jul 16 2 2 25 27 128 138
Jul 15 4 4 0 0 0 0
Highest 10 11 36 42 128 138


Script Execution Time: 11.37416 | SQL Queries: 10 | Members: 501
Ajax Tutorial Top List - Powered by Aardvark Topsites PHP 5.1.2