You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jdemic <jo...@gmail.com> on 2007/05/22 22:05:32 UTC

TabbedPanel and Ajax Validation

Hey All,

I'm attempting to perform ajax validation in a tabbedPanel and I'm getting
the following JS error:

validate is not defined

The validation works fine outside of the tabbedPanel.   My jsp looks like
this, any help is appreciated:

<%@ taglib prefix="s" uri="/struts-tags" %>

<head>
    <s:head theme="ajax" debug="true"/>
</head>

<body>
<s:form name="password_form" action="accountSettings!save.action"
method="POST" theme="ajax" validate="true" >
    <s:password label="Password" name="password1" />
    <s:fielderror/>
    <s:password label="Password (Again)" name="password2"/>
   <s:submit theme="ajax" targets="wrap"/>
</s:form>
</body>
-- 
View this message in context: http://www.nabble.com/TabbedPanel-and-Ajax-Validation-tf3800156.html#a10751497
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: TabbedPanel and Ajax Validation

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Best option:
The dojo version in 2.0.6 supports the 'separateScripts' attribute, so 
you can create your own div.ftl template that always includes this 
attribute set to true for the div (that's what I did) .  Just modify the 
existing ajax div template and create your own theme containing just the 
new div.  It's better than hacking scripts back into your page.

Otherwise use your form outside of a remote div so you can see how it's 
rendered, then copy those script snippets to your containing page and 
convert it back to remote.

Also use the 'Web Developer' plugin for Firefox to view the final html.  
It shows the html from the run-time DOM rather than 'view source'.  
https://addons.mozilla.org/en-US/firefox/addon/60

jdemic wrote:
> Thanks Jeromy, is there anywhere that points out what all the embedded
> javascript is?  I suspect i might be missing an include which is causing the
> validation errors not to render...
>
>
> Jeromy Evans - Blue Sky Minds wrote:
>   
>> Assuming you're using an <s:div theme="ajax"> for the tab that contains 
>> your form, the scripts are 'stripped out' due to this bug: 
>> https://issues.apache.org/struts/browse/WW-1766
>> Your work-round to include the scripts manually should work if you 
>> include ALL the missing embedded javascript.
>>
>> jdemic wrote:
>>     
>>> Thanks for the pointer Musachy.  I compared the html of both and it seems
>>> like the following was missing with the jsp  displayed in the
>>> tabbedPanel:
>>>
>>> <script src="/ood/struts/validationClient.js"></script>
>>> <script src="/ood/dwr/interface/validator.js"></script>
>>> <script src="/ood/dwr/engine.js"></script>
>>> <script src="/ood/struts/ajax/validation.js"></script>
>>> <script src="/ood/struts/xhtml/validation.js"></script>
>>>
>>> I manually added these to our header.jsp and I can now see struts sending
>>> the validation request to dwr.  The validation messages are not
>>> displaying
>>> however.  From FB, the result from DWR looks like this:
>>>
>>> var s0={};var s1=[];s0.actionErrors=s1;
>>> var s2=[];s0.actionMessages=s2;var s3={};s0.fieldErrors=s3;
>>> DWREngine._handleResponse('8173_1179871602745', s0);
>>>
>>> Which seems to indicate there is an action error in there.  This is
>>> occurring when the action is executed within and outside of the
>>> tabbedPanel.  
>>> Any idea what i need to do to get these to display?  Additionally, how
>>> bad
>>> of an idea is it to globally/manually include those scripts?
>>>
>>>
>>>
>>>
>>> Musachy Barroso wrote:
>>>   
>>>       
>>>> I don't see the tabPanel, assuming this is the jsp without it. Compare
>>>> the
>>>> generated html with/without the tabPanel, there should be a validation
>>>> function in both.
>>>>
>>>> musachy
>>>>
>>>> On 5/22/07, jdemic <jo...@gmail.com> wrote:
>>>>     
>>>>         
>>>>> Hey All,
>>>>>
>>>>> I'm attempting to perform ajax validation in a tabbedPanel and I'm
>>>>> getting
>>>>> the following JS error:
>>>>>
>>>>> validate is not defined
>>>>>
>>>>> The validation works fine outside of the tabbedPanel.   My jsp looks
>>>>> like
>>>>> this, any help is appreciated:
>>>>>
>>>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>>>
>>>>> <head>
>>>>>     <s:head theme="ajax" debug="true"/>
>>>>> </head>
>>>>>
>>>>> <body>
>>>>> <s:form name="password_form" action="accountSettings!save.action"
>>>>> method="POST" theme="ajax" validate="true" >
>>>>>     <s:password label="Password" name="password1" />
>>>>>     <s:fielderror/>
>>>>>     <s:password label="Password (Again)" name="password2"/>
>>>>>    <s:submit theme="ajax" targets="wrap"/>
>>>>> </s:form>
>>>>> </body>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/TabbedPanel-and-Ajax-Validation-tf3800156.html#a10751497
>>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>>       
>>>>>           
>>>> -- 
>>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: TabbedPanel and Ajax Validation

Posted by jdemic <jo...@gmail.com>.
Thanks Jeromy, is there anywhere that points out what all the embedded
javascript is?  I suspect i might be missing an include which is causing the
validation errors not to render...


Jeromy Evans - Blue Sky Minds wrote:
> 
> Assuming you're using an <s:div theme="ajax"> for the tab that contains 
> your form, the scripts are 'stripped out' due to this bug: 
> https://issues.apache.org/struts/browse/WW-1766
> Your work-round to include the scripts manually should work if you 
> include ALL the missing embedded javascript.
> 
> jdemic wrote:
>> Thanks for the pointer Musachy.  I compared the html of both and it seems
>> like the following was missing with the jsp  displayed in the
>> tabbedPanel:
>>
>> <script src="/ood/struts/validationClient.js"></script>
>> <script src="/ood/dwr/interface/validator.js"></script>
>> <script src="/ood/dwr/engine.js"></script>
>> <script src="/ood/struts/ajax/validation.js"></script>
>> <script src="/ood/struts/xhtml/validation.js"></script>
>>
>> I manually added these to our header.jsp and I can now see struts sending
>> the validation request to dwr.  The validation messages are not
>> displaying
>> however.  From FB, the result from DWR looks like this:
>>
>> var s0={};var s1=[];s0.actionErrors=s1;
>> var s2=[];s0.actionMessages=s2;var s3={};s0.fieldErrors=s3;
>> DWREngine._handleResponse('8173_1179871602745', s0);
>>
>> Which seems to indicate there is an action error in there.  This is
>> occurring when the action is executed within and outside of the
>> tabbedPanel.  
>> Any idea what i need to do to get these to display?  Additionally, how
>> bad
>> of an idea is it to globally/manually include those scripts?
>>
>>
>>
>>
>> Musachy Barroso wrote:
>>   
>>> I don't see the tabPanel, assuming this is the jsp without it. Compare
>>> the
>>> generated html with/without the tabPanel, there should be a validation
>>> function in both.
>>>
>>> musachy
>>>
>>> On 5/22/07, jdemic <jo...@gmail.com> wrote:
>>>     
>>>> Hey All,
>>>>
>>>> I'm attempting to perform ajax validation in a tabbedPanel and I'm
>>>> getting
>>>> the following JS error:
>>>>
>>>> validate is not defined
>>>>
>>>> The validation works fine outside of the tabbedPanel.   My jsp looks
>>>> like
>>>> this, any help is appreciated:
>>>>
>>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>>
>>>> <head>
>>>>     <s:head theme="ajax" debug="true"/>
>>>> </head>
>>>>
>>>> <body>
>>>> <s:form name="password_form" action="accountSettings!save.action"
>>>> method="POST" theme="ajax" validate="true" >
>>>>     <s:password label="Password" name="password1" />
>>>>     <s:fielderror/>
>>>>     <s:password label="Password (Again)" name="password2"/>
>>>>    <s:submit theme="ajax" targets="wrap"/>
>>>> </s:form>
>>>> </body>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/TabbedPanel-and-Ajax-Validation-tf3800156.html#a10751497
>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>       
>>> -- 
>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>
>>>
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/TabbedPanel-and-Ajax-Validation-tf3800156.html#a10755595
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: TabbedPanel and Ajax Validation

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Assuming you're using an <s:div theme="ajax"> for the tab that contains 
your form, the scripts are 'stripped out' due to this bug: 
https://issues.apache.org/struts/browse/WW-1766
Your work-round to include the scripts manually should work if you 
include ALL the missing embedded javascript.

jdemic wrote:
> Thanks for the pointer Musachy.  I compared the html of both and it seems
> like the following was missing with the jsp  displayed in the tabbedPanel:
>
> <script src="/ood/struts/validationClient.js"></script>
> <script src="/ood/dwr/interface/validator.js"></script>
> <script src="/ood/dwr/engine.js"></script>
> <script src="/ood/struts/ajax/validation.js"></script>
> <script src="/ood/struts/xhtml/validation.js"></script>
>
> I manually added these to our header.jsp and I can now see struts sending
> the validation request to dwr.  The validation messages are not displaying
> however.  From FB, the result from DWR looks like this:
>
> var s0={};var s1=[];s0.actionErrors=s1;
> var s2=[];s0.actionMessages=s2;var s3={};s0.fieldErrors=s3;
> DWREngine._handleResponse('8173_1179871602745', s0);
>
> Which seems to indicate there is an action error in there.  This is
> occurring when the action is executed within and outside of the tabbedPanel.  
> Any idea what i need to do to get these to display?  Additionally, how bad
> of an idea is it to globally/manually include those scripts?
>
>
>
>
> Musachy Barroso wrote:
>   
>> I don't see the tabPanel, assuming this is the jsp without it. Compare the
>> generated html with/without the tabPanel, there should be a validation
>> function in both.
>>
>> musachy
>>
>> On 5/22/07, jdemic <jo...@gmail.com> wrote:
>>     
>>> Hey All,
>>>
>>> I'm attempting to perform ajax validation in a tabbedPanel and I'm
>>> getting
>>> the following JS error:
>>>
>>> validate is not defined
>>>
>>> The validation works fine outside of the tabbedPanel.   My jsp looks like
>>> this, any help is appreciated:
>>>
>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>
>>> <head>
>>>     <s:head theme="ajax" debug="true"/>
>>> </head>
>>>
>>> <body>
>>> <s:form name="password_form" action="accountSettings!save.action"
>>> method="POST" theme="ajax" validate="true" >
>>>     <s:password label="Password" name="password1" />
>>>     <s:fielderror/>
>>>     <s:password label="Password (Again)" name="password2"/>
>>>    <s:submit theme="ajax" targets="wrap"/>
>>> </s:form>
>>> </body>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/TabbedPanel-and-Ajax-Validation-tf3800156.html#a10751497
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>       
>> -- 
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: TabbedPanel and Ajax Validation

Posted by Musachy Barroso <mu...@gmail.com>.
Those scripts are included by the head tag if I don't remember wrong, so set
theme="xhtml" or "css_xhtml" (on the head tag). I haven't use DWR before so
I can't help you much. Did you configure it on web.xml?

Rest assured that ajax validation is way easier in 2.1 (just add an
interceptor to your action).

musachy

On 5/22/07, jdemic <jo...@gmail.com> wrote:
>
>
> Thanks for the pointer Musachy.  I compared the html of both and it seems
> like the following was missing with the jsp  displayed in the tabbedPanel:
>
> <script src="/ood/struts/validationClient.js"></script>
> <script src="/ood/dwr/interface/validator.js"></script>
> <script src="/ood/dwr/engine.js"></script>
> <script src="/ood/struts/ajax/validation.js"></script>
> <script src="/ood/struts/xhtml/validation.js"></script>
>
> I manually added these to our header.jsp and I can now see struts sending
> the validation request to dwr.  The validation messages are not displaying
> however.  From FB, the result from DWR looks like this:
>
> var s0={};var s1=[];s0.actionErrors=s1;
> var s2=[];s0.actionMessages=s2;var s3={};s0.fieldErrors=s3;
> DWREngine._handleResponse('8173_1179871602745', s0);
>
> Which seems to indicate there is an action error in there.  This is
> occurring when the action is executed within and outside of the
> tabbedPanel.
> Any idea what i need to do to get these to display?  Additionally, how bad
> of an idea is it to globally/manually include those scripts?
>
>
>
>
> Musachy Barroso wrote:
> >
> > I don't see the tabPanel, assuming this is the jsp without it. Compare
> the
> > generated html with/without the tabPanel, there should be a validation
> > function in both.
> >
> > musachy
> >
> > On 5/22/07, jdemic <jo...@gmail.com> wrote:
> >>
> >>
> >> Hey All,
> >>
> >> I'm attempting to perform ajax validation in a tabbedPanel and I'm
> >> getting
> >> the following JS error:
> >>
> >> validate is not defined
> >>
> >> The validation works fine outside of the tabbedPanel.   My jsp looks
> like
> >> this, any help is appreciated:
> >>
> >> <%@ taglib prefix="s" uri="/struts-tags" %>
> >>
> >> <head>
> >>     <s:head theme="ajax" debug="true"/>
> >> </head>
> >>
> >> <body>
> >> <s:form name="password_form" action="accountSettings!save.action"
> >> method="POST" theme="ajax" validate="true" >
> >>     <s:password label="Password" name="password1" />
> >>     <s:fielderror/>
> >>     <s:password label="Password (Again)" name="password2"/>
> >>    <s:submit theme="ajax" targets="wrap"/>
> >> </s:form>
> >> </body>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/TabbedPanel-and-Ajax-Validation-tf3800156.html#a10751497
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/TabbedPanel-and-Ajax-Validation-tf3800156.html#a10753729
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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

Re: TabbedPanel and Ajax Validation

Posted by jdemic <jo...@gmail.com>.
Thanks for the pointer Musachy.  I compared the html of both and it seems
like the following was missing with the jsp  displayed in the tabbedPanel:

<script src="/ood/struts/validationClient.js"></script>
<script src="/ood/dwr/interface/validator.js"></script>
<script src="/ood/dwr/engine.js"></script>
<script src="/ood/struts/ajax/validation.js"></script>
<script src="/ood/struts/xhtml/validation.js"></script>

I manually added these to our header.jsp and I can now see struts sending
the validation request to dwr.  The validation messages are not displaying
however.  From FB, the result from DWR looks like this:

var s0={};var s1=[];s0.actionErrors=s1;
var s2=[];s0.actionMessages=s2;var s3={};s0.fieldErrors=s3;
DWREngine._handleResponse('8173_1179871602745', s0);

Which seems to indicate there is an action error in there.  This is
occurring when the action is executed within and outside of the tabbedPanel.  
Any idea what i need to do to get these to display?  Additionally, how bad
of an idea is it to globally/manually include those scripts?




Musachy Barroso wrote:
> 
> I don't see the tabPanel, assuming this is the jsp without it. Compare the
> generated html with/without the tabPanel, there should be a validation
> function in both.
> 
> musachy
> 
> On 5/22/07, jdemic <jo...@gmail.com> wrote:
>>
>>
>> Hey All,
>>
>> I'm attempting to perform ajax validation in a tabbedPanel and I'm
>> getting
>> the following JS error:
>>
>> validate is not defined
>>
>> The validation works fine outside of the tabbedPanel.   My jsp looks like
>> this, any help is appreciated:
>>
>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>
>> <head>
>>     <s:head theme="ajax" debug="true"/>
>> </head>
>>
>> <body>
>> <s:form name="password_form" action="accountSettings!save.action"
>> method="POST" theme="ajax" validate="true" >
>>     <s:password label="Password" name="password1" />
>>     <s:fielderror/>
>>     <s:password label="Password (Again)" name="password2"/>
>>    <s:submit theme="ajax" targets="wrap"/>
>> </s:form>
>> </body>
>> --
>> View this message in context:
>> http://www.nabble.com/TabbedPanel-and-Ajax-Validation-tf3800156.html#a10751497
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> 

-- 
View this message in context: http://www.nabble.com/TabbedPanel-and-Ajax-Validation-tf3800156.html#a10753729
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: TabbedPanel and Ajax Validation

Posted by Musachy Barroso <mu...@gmail.com>.
I don't see the tabPanel, assuming this is the jsp without it. Compare the
generated html with/without the tabPanel, there should be a validation
function in both.

musachy

On 5/22/07, jdemic <jo...@gmail.com> wrote:
>
>
> Hey All,
>
> I'm attempting to perform ajax validation in a tabbedPanel and I'm getting
> the following JS error:
>
> validate is not defined
>
> The validation works fine outside of the tabbedPanel.   My jsp looks like
> this, any help is appreciated:
>
> <%@ taglib prefix="s" uri="/struts-tags" %>
>
> <head>
>     <s:head theme="ajax" debug="true"/>
> </head>
>
> <body>
> <s:form name="password_form" action="accountSettings!save.action"
> method="POST" theme="ajax" validate="true" >
>     <s:password label="Password" name="password1" />
>     <s:fielderror/>
>     <s:password label="Password (Again)" name="password2"/>
>    <s:submit theme="ajax" targets="wrap"/>
> </s:form>
> </body>
> --
> View this message in context:
> http://www.nabble.com/TabbedPanel-and-Ajax-Validation-tf3800156.html#a10751497
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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