You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bart Busschots <ba...@so-4pt.net> on 2006/08/06 21:33:11 UTC

Re: Validator not getting called and I can't see why [resolved]

OK, I got all this figured out in the end.

The validator was being called but because of problems with the page 
attribute in the form the validator appears to have been receiving a 
page value of zero and hence not validating the items on pages 1 or two 
because neither 1 nor 2 are less that or equal to zero! When I did get 
the validator to be called it still wasn't working right but I got that 
fixed too.

Anyhow, I did up a blog post about it which can be found here: 
http://www.bartbusschots.ie/blog/?p=262

If people thing an edited version of this would be a useful addition to 
the Wiki work away, just credit me or link to the original blog post and 
I'll be more than happy.

Cheers for your help guys,

Bart.

Bart Busschots wrote:
> I'm either missing something stupid (which is always possible) or I've 
> managed to break the validator. I have an app that uses validator all 
> over the place and it's working fine in all my other actions but for 
> this one action it is simply not getting called.
>
> I can't see any difference between this action/form/validation and all 
> the other ones that are working.
>
> This is the form:
>
>  <form-bean name="createStudentGroupForm" 
> type="org.apache.struts.validator.DynaValidatorForm">
>   <form-property name="groupName" type="java.lang.String" />
>   <form-property name="noStudents" type="java.lang.String" />
>   <form-property name="groupType" type="java.lang.String" />
>   <form-property name="wikiText" type="java.lang.String" />
>   <form-property name="studentNames" type="java.lang.String[]" />
>  </form-bean>
>
> This is the action:
>
>  <action path="/mentor/createStudentGroupStep1" 
> type="vtie.portal.mentor.CreateStudentGroupPrepareAction" 
> name="createStudentGroupForm" scope="session" validate="true" 
> input="/home/mentor/addStudentGroupForm.jsp">
>   <forward name="createAnonymous" 
> path="/do/mentor/createAnonymousStudentGroup" />
>   <forward name="getStudentNames" 
> path="/home/mentor/getStudentNamesForm.jsp" />
>   <forward name="fail" path="/home/mentor/addStudentGroupForm.jsp" />
>  </action>
>
> And this is the validation:
>
>  <form name="createStudentGroupForm">
>   <field property="groupName" page="1" depends="required, mask">
>    <var><var-name>mask</var-name><var-value>^[a-zA-Z]+[\w\ 
> ]*$</var-value></var>
>    <arg0 key="mentor.createStudentGroup.groupName.label"/>
>   </field>
>   <field property="noStudents" page="1" depends="required, integer">
>    <arg0 key="mentor.createStudentGroup.noStudents.label"/>
>   </field>
>   <field property="studentNames" page="2" depends="required">
>    <arg0 key="mentor.createStudentGroup.studentNames.label"/>
>   </field>
>  </form>
>
> Can anyone see something obviously wrong there?
>
> Cheers,
>
> Bart.
>
> ---------------------------------------------------------------------
> 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: Validator not getting called and I can't see why [resolved]

Posted by Romu <ro...@gmail.com>.
for example  :
mentor.createStudentGroup
>
> .groupName.label = the Student Group Name
>


2006/8/7, Romu <ro...@gmail.com>:
>
> U mean a javascript error ?
>
> u need to define  a message.properties file too which will define the
> error messa
>
>
> 2006/8/6, Bart Busschots < bart-lists@so-4pt.net>:
>
> > OK, I got all this figured out in the end.
> >
> > The validator was being called but because of problems with the page
> > attribute in the form the validator appears to have been receiving a
> > page value of zero and hence not validating the items on pages 1 or two
> > because neither 1 nor 2 are less that or equal to zero! When I did get
> > the validator to be called it still wasn't working right but I got that
> > fixed too.
> >
> > Anyhow, I did up a blog post about it which can be found here:
> > http://www.bartbusschots.ie/blog/?p=262
> >
> > If people thing an edited version of this would be a useful addition to
> > the Wiki work away, just credit me or link to the original blog post and
> > I'll be more than happy.
> >
> > Cheers for your help guys,
> >
> > Bart.
> >
> > Bart Busschots wrote:
> > > I'm either missing something stupid (which is always possible) or I've
> > > managed to break the validator. I have an app that uses validator all
> > > over the place and it's working fine in all my other actions but for
> > > this one action it is simply not getting called.
> > >
> > > I can't see any difference between this action/form/validation and all
> > > the other ones that are working.
> > >
> > > This is the form:
> > >
> > >  <form-bean name="createStudentGroupForm"
> > > type="org.apache.struts.validator.DynaValidatorForm">
> > >   <form-property name="groupName" type="java.lang.String " />
> > >   <form-property name="noStudents" type="java.lang.String" />
> > >   <form-property name="groupType" type="java.lang.String" />
> > >   <form-property name="wikiText" type=" java.lang.String" />
> > >   <form-property name="studentNames" type="java.lang.String[]" />
> > >  </form-bean>
> > >
> > > This is the action:
> > >
> > >  <action path="/mentor/createStudentGroupStep1"
> > > type="vtie.portal.mentor.CreateStudentGroupPrepareAction"
> > > name="createStudentGroupForm" scope="session" validate="true"
> > > input="/home/mentor/addStudentGroupForm.jsp">
> > >   <forward name="createAnonymous"
> > > path="/do/mentor/createAnonymousStudentGroup" />
> > >   <forward name="getStudentNames"
> > > path="/home/mentor/getStudentNamesForm.jsp" />
> > >   <forward name="fail" path="/home/mentor/addStudentGroupForm.jsp" />
> > >  </action>
> > >
> > > And this is the validation:
> > >
> > >  <form name="createStudentGroupForm">
> > >   <field property="groupName" page="1" depends="required, mask">
> > >    <var><var-name>mask</var-name><var-value>^[a-zA-Z]+[\w\
> > > ]*$</var-value></var>
> > >    <arg0 key="mentor.createStudentGroup.groupName.label"/>
> > >   </field>
> > >   <field property="noStudents" page="1" depends="required, integer">
> > >    <arg0 key="mentor.createStudentGroup.noStudents.label"/>
> > >   </field>
> > >   <field property="studentNames" page="2" depends="required">
> > >    <arg0 key=" mentor.createStudentGroup.studentNames.label"/>
> > >   </field>
> > >  </form>
> > >
> > > Can anyone see something obviously wrong there?
> > >
> > > Cheers,
> > >
> > > Bart.
> > >
> > > ---------------------------------------------------------------------
> > > 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: Validator not getting called and I can't see why [resolved]

Posted by Bart Busschots <ba...@so-4pt.net>.
Romu wrote:
> U mean a javascript error ?
>
No, I don't use clientside validation on my forms. It's going to the 
server anyhow so I don't see the point, just an extra layer for things 
to not work in.


> u need to define  a message.properties file too which will define the 
> error
> messa
Good point, post edited.

Bart.
>
>
> 2006/8/6, Bart Busschots <ba...@so-4pt.net>:
>>
>> OK, I got all this figured out in the end.
>>
>> The validator was being called but because of problems with the page
>> attribute in the form the validator appears to have been receiving a
>> page value of zero and hence not validating the items on pages 1 or two
>> because neither 1 nor 2 are less that or equal to zero! When I did get
>> the validator to be called it still wasn't working right but I got that
>> fixed too.
>>
>> Anyhow, I did up a blog post about it which can be found here:
>> http://www.bartbusschots.ie/blog/?p=262
>>
>> If people thing an edited version of this would be a useful addition to
>> the Wiki work away, just credit me or link to the original blog post and
>> I'll be more than happy.
>>
>> Cheers for your help guys,
>>
>> Bart.
>>
>> Bart Busschots wrote:
>> > I'm either missing something stupid (which is always possible) or I've
>> > managed to break the validator. I have an app that uses validator all
>> > over the place and it's working fine in all my other actions but for
>> > this one action it is simply not getting called.
>> >
>> > I can't see any difference between this action/form/validation and all
>> > the other ones that are working.
>> >
>> > This is the form:
>> >
>> >  <form-bean name="createStudentGroupForm"
>> > type="org.apache.struts.validator.DynaValidatorForm">
>> >   <form-property name="groupName" type="java.lang.String" />
>> >   <form-property name="noStudents" type="java.lang.String" />
>> >   <form-property name="groupType" type="java.lang.String" />
>> >   <form-property name="wikiText" type="java.lang.String" />
>> >   <form-property name="studentNames" type="java.lang.String[]" />
>> >  </form-bean>
>> >
>> > This is the action:
>> >
>> >  <action path="/mentor/createStudentGroupStep1"
>> > type="vtie.portal.mentor.CreateStudentGroupPrepareAction"
>> > name="createStudentGroupForm" scope="session" validate="true"
>> > input="/home/mentor/addStudentGroupForm.jsp">
>> >   <forward name="createAnonymous"
>> > path="/do/mentor/createAnonymousStudentGroup" />
>> >   <forward name="getStudentNames"
>> > path="/home/mentor/getStudentNamesForm.jsp" />
>> >   <forward name="fail" path="/home/mentor/addStudentGroupForm.jsp" />
>> >  </action>
>> >
>> > And this is the validation:
>> >
>> >  <form name="createStudentGroupForm">
>> >   <field property="groupName" page="1" depends="required, mask">
>> >    <var><var-name>mask</var-name><var-value>^[a-zA-Z]+[\w\
>> > ]*$</var-value></var>
>> >    <arg0 key="mentor.createStudentGroup.groupName.label"/>
>> >   </field>
>> >   <field property="noStudents" page="1" depends="required, integer">
>> >    <arg0 key="mentor.createStudentGroup.noStudents.label"/>
>> >   </field>
>> >   <field property="studentNames" page="2" depends="required">
>> >    <arg0 key="mentor.createStudentGroup.studentNames.label"/>
>> >   </field>
>> >  </form>
>> >
>> > Can anyone see something obviously wrong there?
>> >
>> > Cheers,
>> >
>> > Bart.
>> >
>> > ---------------------------------------------------------------------
>> > 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
>>
>>
>


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


Re: Validator not getting called and I can't see why [resolved]

Posted by Romu <ro...@gmail.com>.
U mean a javascript error ?

u need to define  a message.properties file too which will define the error
messa


2006/8/6, Bart Busschots <ba...@so-4pt.net>:
>
> OK, I got all this figured out in the end.
>
> The validator was being called but because of problems with the page
> attribute in the form the validator appears to have been receiving a
> page value of zero and hence not validating the items on pages 1 or two
> because neither 1 nor 2 are less that or equal to zero! When I did get
> the validator to be called it still wasn't working right but I got that
> fixed too.
>
> Anyhow, I did up a blog post about it which can be found here:
> http://www.bartbusschots.ie/blog/?p=262
>
> If people thing an edited version of this would be a useful addition to
> the Wiki work away, just credit me or link to the original blog post and
> I'll be more than happy.
>
> Cheers for your help guys,
>
> Bart.
>
> Bart Busschots wrote:
> > I'm either missing something stupid (which is always possible) or I've
> > managed to break the validator. I have an app that uses validator all
> > over the place and it's working fine in all my other actions but for
> > this one action it is simply not getting called.
> >
> > I can't see any difference between this action/form/validation and all
> > the other ones that are working.
> >
> > This is the form:
> >
> >  <form-bean name="createStudentGroupForm"
> > type="org.apache.struts.validator.DynaValidatorForm">
> >   <form-property name="groupName" type="java.lang.String" />
> >   <form-property name="noStudents" type="java.lang.String" />
> >   <form-property name="groupType" type="java.lang.String" />
> >   <form-property name="wikiText" type="java.lang.String" />
> >   <form-property name="studentNames" type="java.lang.String[]" />
> >  </form-bean>
> >
> > This is the action:
> >
> >  <action path="/mentor/createStudentGroupStep1"
> > type="vtie.portal.mentor.CreateStudentGroupPrepareAction"
> > name="createStudentGroupForm" scope="session" validate="true"
> > input="/home/mentor/addStudentGroupForm.jsp">
> >   <forward name="createAnonymous"
> > path="/do/mentor/createAnonymousStudentGroup" />
> >   <forward name="getStudentNames"
> > path="/home/mentor/getStudentNamesForm.jsp" />
> >   <forward name="fail" path="/home/mentor/addStudentGroupForm.jsp" />
> >  </action>
> >
> > And this is the validation:
> >
> >  <form name="createStudentGroupForm">
> >   <field property="groupName" page="1" depends="required, mask">
> >    <var><var-name>mask</var-name><var-value>^[a-zA-Z]+[\w\
> > ]*$</var-value></var>
> >    <arg0 key="mentor.createStudentGroup.groupName.label"/>
> >   </field>
> >   <field property="noStudents" page="1" depends="required, integer">
> >    <arg0 key="mentor.createStudentGroup.noStudents.label"/>
> >   </field>
> >   <field property="studentNames" page="2" depends="required">
> >    <arg0 key="mentor.createStudentGroup.studentNames.label"/>
> >   </field>
> >  </form>
> >
> > Can anyone see something obviously wrong there?
> >
> > Cheers,
> >
> > Bart.
> >
> > ---------------------------------------------------------------------
> > 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
>
>