Re: [Phplib-users] OOH forms: error validating
Brought to you by:
nhruby,
richardarcher
From: Herouth M. <he...@it...> - 2002-01-29 15:09:41
|
You wrote: > > "Tarique Sani wrote: > > > On Tue, 29 Jan 2002, Matt Williams wrote: > > > > > > You have to manually validate textareas of OOH form in your > > > code > > > > > > :-( > > > > That, or modify the of_textarea to have a similar functionality > > to that of of_text (without the 'multiple' option). > > > > I just did the above for multiple checkboxes (if valid_e exists, > > it checks that at least one checkbox is selected). Not too hard, > > especially in non-multiple mode, where the ndx array is rather > > simple. > > Thanks. > > So I just add a self_validate function to the bottom of > of_textarea.inc and this should check? No, there are two things you have to add: One is self_get_js(), whose parameter is $ndx_array - an array of element numbers within the form. You then write the validation in Javascript. Take a look at of_text for an example, just notice what it does for non-multiple text fields. The other is self_validate(), whose parameter is the value to validate. This function is called on the server side (in case the user disabled javascript). If it returns false, then the validation SUCCEEDED. Otherwise, it must return the error message (Like $this->valid_e or $this->length_e, depending on whether you are checking regexp or length). Again, you may take a look at of_text for an example what to do. It may be that for regexps you'll have to change modifiers to deal with the fact that multiple lines are allowed. Herouth |