That would be the function I mentioned before. With that in mind, I think it
would be better to have the interceptor and the generic function in core, so
it can be used with other js libraries. I was going to put it in the Dojo
plugin as we are moving all the ajax stuff there, but it isn't specific to
Dojo in any way.

musachy

On 4/23/07, Brian Pontarelli <[EMAIL PROTECTED]> wrote:

Excellent. Well, then really all that is lacking is a generic JS script
to handle the response and add errors to the form/labels/some div. It
would be excellent to have a JS plugin model where developers can select
the JS framework they want to use and then they can plugin to the Struts
handling via a little bit of JS glue.

-bp


Musachy Barroso wrote:
> Thanks for the code. Mine is very similar with some JSON encoding
> added. The
> resulting JSON is a little bit different:
>
> /*
> {
>   "errors": [
>       "Error0", "Error1"
>   ],
>   "fieldErrors": {
>       "field1" : ["Error0", "Error1"],
>       "field2": ["Error0", "Error1"],
>   }
> }
> */
>
> musachy
>
> On 4/23/07, Brian Pontarelli <[EMAIL PROTECTED]> wrote:
>>
>> I've also done this exercise twice in the past and both times I used
>> other JS libraries including prototype. My first solution was
>> specifically for WebWork and I don't recall any changes I had to make
>> when moving it over to Struts2.
>>
>> Perhaps it makes sense to ensure that this will be completely pluggable
>> since many folks are using other JS libraries. My solution only
requires
>> a form post that is the same or a partial version of the post that
would
>> normally be submitted. This allows me to use pretty much any library
>> that can handle form submission.
>>
>> I've included my latest interceptor for you guys to look over. Let me
>> know what you think. I was planning on making a Struts2 plugin that had
>> this and the necessary JavaScript files and template to work with
>> Prototype once I had finished it off. But if you are heading in that
>> direction, we should collaborate on it.
>>
>> -bp
>>
>>
>> Musachy Barroso wrote:
>> > This would be for 2.1, and it would be in Bind.js. It is actually
only
>> > one
>> > function, which will be calling the functions in
>> > validation.js(addError/clearErrors...). I'm planning to do some
>> > cleanup after that as we
>> > have some javascript/css files hanging around, which are not used.
>> >
>> > musachy
>> >
>> > On 4/23/07, Ian Roughley <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Is the Ajax code all in a module now (2.1.x)?  Would this change be
>> >> checked into the 2.0.x branch or just the trunk under the Ajax
>> module,
>> >> and then some cleanup/removal of existing code in the trunk?
>> >>
>> >> /Ian
>> >>
>> >> Musachy Barroso wrote:
>> >> > I have this working, but I want to give  it a little more time to
>> >> > anyone to
>> >> > object before committing it :), just to review, these are the
>> >> different
>> >> > validation options:
>> >> >
>> >> > 1. regular form, regular submit button  (normal validation)
>> >> > 2. css_html form, or xhtml form (validate="true"), regular submit
>> >> button
>> >> > (client validation)
>> >> > 3. css_html form, or xhtml form (validate="true"), ajax submit
>> button
>> >> > (client validation)
>> >> > 4. regular form, css_html form, or xhtml form, where action has
the
>> >> > "ajaxValidation" interceptor, ajax submit button (validate="true")
>> >> (ajax
>> >> > validation = dojo+interceptor, no DWR)
>> >> >
>> >> > regards
>> >> > musachy
>> >> >
>> >> > On 4/21/07, Musachy Barroso <[EMAIL PROTECTED]> wrote:
>> >> >>
>> >> >> I'd like to propose a change on the way we do ajax validation.
>> >> >> Instead of
>> >> >> using DWR which requires an external dependency and configuring a
>> >> >> servlet,
>> >> >> I'd like to have an interceptor in the dojo plugin that extends
>> the
>> >> >> validator interceptor, which outputs JSON with the messages when
>> >> >> there are
>> >> >> validation errors.
>> >> >>
>> >> >> To use ajax validation all a user would have to do is add the
>> >> >> interceptor
>> >> >> to his/her class and set "validate" to "true" in either the
>> form, or
>> >> the
>> >> >> submit/anchor that is submitting the form.
>> >> >>
>> >> >> regards
>> >> >> musachy
>> >> >> --
>> >> >> "Hey you! Would you help me to carry the stone?" Pink Floyd
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >>
---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
"Hey you! Would you help me to carry the stone?" Pink Floyd

Reply via email to