HI, 

Thanks very much for your input. I think a lot of the confusion I'm
having is that I've been following 2.1.x documentation while using
2.0.x. Sometimes it's not been clear if the documentation I'm following
is for a particular version or not, and with the many way to do
something it can be easy to get lost, not that I'm complaining mind you,
I love the flexibility. 

I do have basic server-side validation working for forms, but
unfortunately I get the issues with drop-down population after
validation kicks in and returns to my form (validation does work nicely
though :-). I'm really hoping to avoid using prepare as I'm using a
single action to perform crud operations for many classes and my prepare
method would get very large to populate all the drop downs.

A really nice solution so far has been to an action tag to populate
forms, which has worked nicely the rest of the time. I've really liked
using this approach to fill drop-downs, like so:

<s:action namespace="/admin" name="crud.Group.listAll"
id="groupAction"/>

...

<s:select label="Group" name="user.group.id" value="%{user.group.id}" 
  list="%{#groupAction.list}" listKey="id" listValue="name"/>

Using %{#groupAcation.list} to populate the drop down works great, but
the only work around I've seen to fill the select box after validation
returns to the form is rather messy:

http://struts.apache.org/2.1.2/docs/how-do-we-repopulate-controls-when-v
alidation-fails.html

If I could get the form elements to populate after a failed server-side
validation I'd happily just use server-side validation. I'm not sure why
the above jsp won't populate my drop downs after validation returns the
form, does anyone know if I can I get these action tags to work in such
circumstances?

Knowing ajax validation will only work with xhtml/css_html theme is
helpful, I've been using ajax all along which may explain some issues.
You said to use the default interceptor stack for 2.1.2, and the
documentation I read says to use 'jsonValidationWorkflowStack' do I need
both of them or will just the default stack work?

Many thanks for your time.

Gawain

As a side note, I've used the s:autocomplete form element which does
populate drop down boxes after validation forces the page back to the
form, but there's no similar ajax alternative for multiple select boxes
that I can find, so it's just them that are empty now. I feel so close
and yet so far away from my finishing this :-)




-----Original Message-----
From: Jeromy Evans [mailto:[EMAIL PROTECTED] 
Sent: 10 September 2008 01:19
To: Struts Users Mailing List
Subject: Re: ajax validation issue

Gawain Hammond wrote:
>  
> ...
>   
That's a lot of problems, and to work-around each problem you've moved 
to a more sophisticated and complicated solution hoping for the best.

You'll need to get the plain-old-validation working first. If validation

fails, your action's execute method is not invoked, so you need to 
ensure all the data needed by the page is available in that case.  eg. 
If you have a select that needs a list of values, then populate the list

in the prepare method rather than the execute method.

Client-side validation is then generated from your server-side 
validation settings.  It'll only works with xhtml or css_xhtml theme'd 
forms with validate=true. If it fails in individual tags it's possible 
there's something wrong with the markup.  When you isolate it to certain

fields your browser can help you work this out.

If you want to use ajax validation you'll need to ensure you're using 
the default interceptor stack for 2.1.2. It'll use your server-side 
validation settings.  You'll need the sx:head tag in your page and need 
to be attentive to where you use ajax theme'd tags verses other themes 
(eg. if you don't want the form posted via ajax).

I suggest you go back to basics; create a new minimal form with a 
minimal action and it get it to work.

Hope that helps,
 Jeromy Evans



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
----------------------------------------------------------
This transmission is strictly confidential, possibly legally privileged, and 
intended solely for the 
addressee.  Any views or opinions expressed within it are those of the author 
and do not necessarily 
represent those of 192.com, i-CD Publishing (UK) Ltd or any of it's subsidiary 
companies.  If you 
are not the intended recipient then you must not disclose, copy or take any 
action in reliance of this 
transmission. If you have received this transmission in error, please notify 
the sender as soon as 
possible.  No employee or agent is authorised to conclude any binding agreement 
on behalf of 
i-CD Publishing (UK) Ltd with another party by email without express written 
confirmation by an 
authorised employee of the Company. http://www.192.com (Tel: 08000 192 192).  
i-CD Publishing (UK) Ltd 
is incorporated in England and Wales, company number 3148549, VAT No. GB 
673128728.

Reply via email to