Django - custom widget with “did you mean” hints based on validation?

Create custom widget, which renders with JS code for checking possible values as user enters it.

I would prefer the "did you mean" list to be displayed without having to reload the page. Create custom widget, which renders with JS code for checking possible values as user enters it If a user clicks on one of the suggestions I want to perform the form's action without an additional lookup - the value has already been checked. Again, that widget, when clicked, should just submit the form.

I want to keep all the logic outside the view and keep it in the form or in the model. This is a must. On the form you'll have clean() method to validate everything.

If, say, some bogus data passes with submit from p. 2 - you still raise validation error. I want to avoid hardcoded js in the template and push it into the form if possible.It's not a must.

Solved with custom widget, details.

I've been working on this for last couple of days and I got it working. Some parts are ugly because I wanted to make this method reusable thus needed to dynamically generate things - like passing a value from a view to the form (while creating) so that it gets to the widget's rendering method. I've modified a bit my requirements but generally this is the was I did it (using jQuery): 1.

Clicking on a submit button sends the form (serialized) to the ajax handling view. 2. If the form validates then I send back an empty value and if it doesn't validate then I send back the rendered form.

– virtuallight Feb 5 '10 at 22:20 3. When the answer get's back to the js: - if empty then the form is submited and finally properly handled - if not empty (the form with errors and hints is there) I just cover the old form with it 4. Clicking on a hint puts it's value in the input field and the form get's validated via ajax again.

Thx for the answer. It convinced me that digging in the widget is the right choice ;) – virtuallight Feb 5 '10 at 22:21.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions