I've created a function getFormFields which I call for every form I'm
using. In this function I go through all inputs of the form with
form.elements('input, select, textarea')and then I check if the name of the input field exists in form.errors. If there is an error I add a css error class. At the end of the function I return all input fields as a dict. On 16 Jan., 23:56, Massimo Di Pierro <[email protected]> wrote: > I understand. Let me think about this.... the problem is some some > widgets do not have a single input fiels (think if lists and > checkboxes). Please open a ticket in google code so we do not forget. > > On Jan 16, 2:25 pm, David <[email protected]> wrote: > > > > > > > > > Sorry for not being clear; > > > I meant if the field has an error obviously. > > > After form validation, the ie. input would have an error class > > > This would be useful for styling the fields with say "red borders" > > > Alternatively if there is generic way to handle this I would appreciate it. > > > Thanks. > > > On 1/16/12 2:26 PM, Massimo Di Pierro wrote: > > > > Why do you want to add an "error" class to the input? The error class > > > is normally used for inputs. Perhaps I do not understand. > > > > On Jan 15, 7:40 pm, David<[email protected]> wrote: > > >> I was thinking about the form validation. > > > >> I thought that it may be useful to include an "error" class on the input > > >> widget when the form is submitted and has invalid data. > > > >> ie. > > > >> from > > > >> <divclass="w2p_fw"> > > >> <inputid="auth_user_password"class="password"type="password"value=""name="p > > >> assword"> > > >> <divid="password__error"class="error"style="display: block;">too > > >> short</div> > > >> </div> > > > >> to > > > >> <divclass="w2p_fw"> > > >> <inputid="auth_user_password"class="password > > >> error"type="password"value=""name="password"> > > >> <divid="password__error"class="error"style="display: block;">too > > >> short</div> > > >> </div> > > > >> Notice the error is the class of the input. > > > >> I think this would be very useful and don't think it would break any > > >> backwards compatibility. > > > >> Thanks.

