You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Maciej Leks <ml...@zeus.polsl.gliwice.pl> on 2001/11/03 16:22:11 UTC

Bad Intake - part 2

Hi!

Thanks for help and explanations...But I have still some problems...In the Intake XML
file I have one group with two fields. Fields have rules i.e a field
can not be empty, etc.

<group name="Person" key="p" mapToObject="om.Person">
  <field name="Name" key="name" type="String" mapToProperty="Name">
    <rule maxLength="5">Name length cannot be &gt; 5</rule>
    <required-message>This module requires data for this attribute.</required-message>
  </field>
        
  <field name="CityId" key="cityid" type="NumberKey" mapToProperty="CityId">
    <rule mask="[0-9]+">badIdMessage</rule>
  </field>
</group>

In the HTML form I have:

<form method="post" action="$link.setPage("InsertPersonIntake.vm").setAction("InsertPersonIntake")">
...
#formCell ("First and Last Name" "$personGroup.Name.Key" "$!personGroup.Name")
...
<select name="$personGroup.CityId.Key" size="1">
  #foreach($city in $cities)
    #if ( $!personGroup.CityId == $city.CityId )
      <option value="$city.CityId" selected>$city.name</option>
    #else
      <option value="$city.CityId">$city.name</option>
    #end
  #end
 </slect>
 ...
 <input type="submit" name="eventSubmit_doInsert" value="Insert"/>
 ...


InsertPersonIntake screen class is resonsible for preparing iterator
with cities names and ids.

The java action code looks like this:

 public void doInsert(RunData data, Context context) throws Exception
 {
        IntakeTool intake = (IntakeTool) context.get("intake");

        if ( intake.isAllValid() )
        {
           String template = data.getParameters().getString("nextTemplate", TurbineResources.getString("template.homepage", "Index.vm") );
                                        
           setTemplate(data, template);
        }
        else
        {
           setTemplate(data, "InsertPersonIntake.vm");
        }
  } //
...almost like how-to example.

But, it is not working...After handling the form action always I am
redirected to the Insert.vm page (intake.isAllValid() returns always
true), though the form was not full, what is not accordancing with the
rules! And the form data are always null!!!

My question is: What is going on?
Help me....:-(

-- 
  
 Leksiu                          mailto:mleks@zeus.polsl.gliwice.pl


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Bad Intake - part 2

Posted by John McNally <jm...@collab.net>.
The document states the format is like
<rule name="maxLength" value="5">

and you have written
<rule maxLength="5">

which is why I ask if you have read the docs.  The form you are using is
similar to the previous dtd, so I would like to know where you are
getting this information.  The 'class' question follows the same
pattern, i think you are looking at outdated info.

john mcnally

Maciej Leks wrote:
> 
> Hi
> 
> I have read this howto many times...Maybe I wrote something not
> clearly but Intake returns null always even if the form fields are full
> or empty and even if the requeried role is not set...
> 
> Next, problem:
> In the the Intake service howto we have got group tag with attribute
> 'name' but in the example XML file we have 'class' attribute. This
> attribute is not explain in the howto. ???
> 
> JM> Where are you getting your syntax for rules from? Please read the
> JM> service howto:
> 
> JM> http://jakarta.apache.org/turbine/turbine-2/services/intake-service.html
> 
> JM> Also you are not setting the rule required=true anywhere, so intake
> JM> would not report a null field as invalid.
> 
> JM> john mcnally
> 
> JM> Maciej Leks wrote:
> >>
> >> Hi!
> >>
> >> Thanks for help and explanations...But I have still some problems...In the Intake XML
> >> file I have one group with two fields. Fields have rules i.e a field
> >> can not be empty, etc.
> >>
> >> <group name="Person" key="p" mapToObject="om.Person">
> >>   <field name="Name" key="name" type="String" mapToProperty="Name">
> >>     <rule maxLength="5">Name length cannot be &gt; 5</rule>
> >>     <required-message>This module requires data for this attribute.</required-message>
> >>   </field>
> >>
> >>   <field name="CityId" key="cityid" type="NumberKey" mapToProperty="CityId">
> >>     <rule mask="[0-9]+">badIdMessage</rule>
> >>   </field>
> >> </group>
> >>
> >> In the HTML form I have:
> >>
> >> <form method="post" action="$link.setPage("InsertPersonIntake.vm").setAction("InsertPersonIntake")">
> >> ...
> >> #formCell ("First and Last Name" "$personGroup.Name.Key" "$!personGroup.Name")
> >> ...
> >> <select name="$personGroup.CityId.Key" size="1">
> >>   #foreach($city in $cities)
> >>     #if ( $!personGroup.CityId == $city.CityId )
> >>       <option value="$city.CityId" selected>$city.name</option>
> >>     #else
> >>       <option value="$city.CityId">$city.name</option>
> >>     #end
> >>   #end
> >>  </slect>
> >>  ...
> >>  <input type="submit" name="eventSubmit_doInsert" value="Insert"/>
> >>  ...
> >>
> >> InsertPersonIntake screen class is resonsible for preparing iterator
> >> with cities names and ids.
> >>
> >> The java action code looks like this:
> >>
> >>  public void doInsert(RunData data, Context context) throws Exception
> >>  {
> >>         IntakeTool intake = (IntakeTool) context.get("intake");
> >>
> >>         if ( intake.isAllValid() )
> >>         {
> >>            String template = data.getParameters().getString("nextTemplate", TurbineResources.getString("template.homepage", "Index.vm") );
> >>
> >>            setTemplate(data, template);
> >>         }
> >>         else
> >>         {
> >>            setTemplate(data, "InsertPersonIntake.vm");
> >>         }
> >>   } //
> >> ...almost like how-to example.
> >>
> >> But, it is not working...After handling the form action always I am
> >> redirected to the Insert.vm page (intake.isAllValid() returns always
> >> true), though the form was not full, what is not accordancing with the
> >> rules! And the form data are always null!!!
> >>
> >> My question is: What is going on?
> >> Help me....:-(
> >>
> >> --
> >>
> >>  Leksiu                          mailto:mleks@zeus.polsl.gliwice.pl
> >>
> >> --
> >> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> >> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> JM> --
> JM> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> JM> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> --
> Best regards,
>  Maciej                            mailto:mleks@zeus.polsl.gliwice.pl
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[2]: Bad Intake - part 2

Posted by Maciej Leks <ml...@zeus.polsl.gliwice.pl>.
Hi

I have read this howto many times...Maybe I wrote something not
clearly but Intake returns null always even if the form fields are full
or empty and even if the requeried role is not set...

Next, problem:
In the the Intake service howto we have got group tag with attribute
'name' but in the example XML file we have 'class' attribute. This
attribute is not explain in the howto. ???


JM> Where are you getting your syntax for rules from? Please read the
JM> service howto:

JM> http://jakarta.apache.org/turbine/turbine-2/services/intake-service.html

JM> Also you are not setting the rule required=true anywhere, so intake
JM> would not report a null field as invalid.

JM> john mcnally

JM> Maciej Leks wrote:
>> 
>> Hi!
>> 
>> Thanks for help and explanations...But I have still some problems...In the Intake XML
>> file I have one group with two fields. Fields have rules i.e a field
>> can not be empty, etc.
>> 
>> <group name="Person" key="p" mapToObject="om.Person">
>>   <field name="Name" key="name" type="String" mapToProperty="Name">
>>     <rule maxLength="5">Name length cannot be &gt; 5</rule>
>>     <required-message>This module requires data for this attribute.</required-message>
>>   </field>
>> 
>>   <field name="CityId" key="cityid" type="NumberKey" mapToProperty="CityId">
>>     <rule mask="[0-9]+">badIdMessage</rule>
>>   </field>
>> </group>
>> 
>> In the HTML form I have:
>> 
>> <form method="post" action="$link.setPage("InsertPersonIntake.vm").setAction("InsertPersonIntake")">
>> ...
>> #formCell ("First and Last Name" "$personGroup.Name.Key" "$!personGroup.Name")
>> ...
>> <select name="$personGroup.CityId.Key" size="1">
>>   #foreach($city in $cities)
>>     #if ( $!personGroup.CityId == $city.CityId )
>>       <option value="$city.CityId" selected>$city.name</option>
>>     #else
>>       <option value="$city.CityId">$city.name</option>
>>     #end
>>   #end
>>  </slect>
>>  ...
>>  <input type="submit" name="eventSubmit_doInsert" value="Insert"/>
>>  ...
>> 
>> InsertPersonIntake screen class is resonsible for preparing iterator
>> with cities names and ids.
>> 
>> The java action code looks like this:
>> 
>>  public void doInsert(RunData data, Context context) throws Exception
>>  {
>>         IntakeTool intake = (IntakeTool) context.get("intake");
>> 
>>         if ( intake.isAllValid() )
>>         {
>>            String template = data.getParameters().getString("nextTemplate", TurbineResources.getString("template.homepage", "Index.vm") );
>> 
>>            setTemplate(data, template);
>>         }
>>         else
>>         {
>>            setTemplate(data, "InsertPersonIntake.vm");
>>         }
>>   } //
>> ...almost like how-to example.
>> 
>> But, it is not working...After handling the form action always I am
>> redirected to the Insert.vm page (intake.isAllValid() returns always
>> true), though the form was not full, what is not accordancing with the
>> rules! And the form data are always null!!!
>> 
>> My question is: What is going on?
>> Help me....:-(
>> 
>> --
>> 
>>  Leksiu                          mailto:mleks@zeus.polsl.gliwice.pl
>> 
>> --
>> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>> For additional commands, e-mail: <ma...@jakarta.apache.org>

JM> --
JM> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
JM> For additional commands, e-mail: <ma...@jakarta.apache.org>




-- 
Best regards,
 Maciej                            mailto:mleks@zeus.polsl.gliwice.pl


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Bad Intake - part 2

Posted by John McNally <jm...@collab.net>.
Where are you getting your syntax for rules from? Please read the
service howto:

http://jakarta.apache.org/turbine/turbine-2/services/intake-service.html

Also you are not setting the rule required=true anywhere, so intake
would not report a null field as invalid.

john mcnally

Maciej Leks wrote:
> 
> Hi!
> 
> Thanks for help and explanations...But I have still some problems...In the Intake XML
> file I have one group with two fields. Fields have rules i.e a field
> can not be empty, etc.
> 
> <group name="Person" key="p" mapToObject="om.Person">
>   <field name="Name" key="name" type="String" mapToProperty="Name">
>     <rule maxLength="5">Name length cannot be &gt; 5</rule>
>     <required-message>This module requires data for this attribute.</required-message>
>   </field>
> 
>   <field name="CityId" key="cityid" type="NumberKey" mapToProperty="CityId">
>     <rule mask="[0-9]+">badIdMessage</rule>
>   </field>
> </group>
> 
> In the HTML form I have:
> 
> <form method="post" action="$link.setPage("InsertPersonIntake.vm").setAction("InsertPersonIntake")">
> ...
> #formCell ("First and Last Name" "$personGroup.Name.Key" "$!personGroup.Name")
> ...
> <select name="$personGroup.CityId.Key" size="1">
>   #foreach($city in $cities)
>     #if ( $!personGroup.CityId == $city.CityId )
>       <option value="$city.CityId" selected>$city.name</option>
>     #else
>       <option value="$city.CityId">$city.name</option>
>     #end
>   #end
>  </slect>
>  ...
>  <input type="submit" name="eventSubmit_doInsert" value="Insert"/>
>  ...
> 
> InsertPersonIntake screen class is resonsible for preparing iterator
> with cities names and ids.
> 
> The java action code looks like this:
> 
>  public void doInsert(RunData data, Context context) throws Exception
>  {
>         IntakeTool intake = (IntakeTool) context.get("intake");
> 
>         if ( intake.isAllValid() )
>         {
>            String template = data.getParameters().getString("nextTemplate", TurbineResources.getString("template.homepage", "Index.vm") );
> 
>            setTemplate(data, template);
>         }
>         else
>         {
>            setTemplate(data, "InsertPersonIntake.vm");
>         }
>   } //
> ...almost like how-to example.
> 
> But, it is not working...After handling the form action always I am
> redirected to the Insert.vm page (intake.isAllValid() returns always
> true), though the form was not full, what is not accordancing with the
> rules! And the form data are always null!!!
> 
> My question is: What is going on?
> Help me....:-(
> 
> --
> 
>  Leksiu                          mailto:mleks@zeus.polsl.gliwice.pl
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Bad Intake - part 2

Posted by Scott Eade <se...@backstagetech.com.au>.
Try validating intake.xml with an xml validator.

This will often point to the problem.

HTH

Scott

----- Original Message -----
From: "Maciej Leks" <ml...@zeus.polsl.gliwice.pl>
To: <tu...@jakarta.apache.org>
Sent: Sunday, November 04, 2001 2:22 AM
Subject: Bad Intake - part 2


> Hi!
>
> Thanks for help and explanations...But I have still some problems...In the
Intake XML
> file I have one group with two fields. Fields have rules i.e a field
> can not be empty, etc.
>
> <group name="Person" key="p" mapToObject="om.Person">
>   <field name="Name" key="name" type="String" mapToProperty="Name">
>     <rule maxLength="5">Name length cannot be &gt; 5</rule>
>     <required-message>This module requires data for this
attribute.</required-message>
>   </field>
>
>   <field name="CityId" key="cityid" type="NumberKey"
mapToProperty="CityId">
>     <rule mask="[0-9]+">badIdMessage</rule>
>   </field>
> </group>
>
> In the HTML form I have:
>
> <form method="post"
action="$link.setPage("InsertPersonIntake.vm").setAction("InsertPersonIntake
")">
> ...
> #formCell ("First and Last Name" "$personGroup.Name.Key"
"$!personGroup.Name")
> ...
> <select name="$personGroup.CityId.Key" size="1">
>   #foreach($city in $cities)
>     #if ( $!personGroup.CityId == $city.CityId )
>       <option value="$city.CityId" selected>$city.name</option>
>     #else
>       <option value="$city.CityId">$city.name</option>
>     #end
>   #end
>  </slect>
>  ...
>  <input type="submit" name="eventSubmit_doInsert" value="Insert"/>
>  ...
>
>
> InsertPersonIntake screen class is resonsible for preparing iterator
> with cities names and ids.
>
> The java action code looks like this:
>
>  public void doInsert(RunData data, Context context) throws Exception
>  {
>         IntakeTool intake = (IntakeTool) context.get("intake");
>
>         if ( intake.isAllValid() )
>         {
>            String template =
data.getParameters().getString("nextTemplate",
TurbineResources.getString("template.homepage", "Index.vm") );
>
>            setTemplate(data, template);
>         }
>         else
>         {
>            setTemplate(data, "InsertPersonIntake.vm");
>         }
>   } //
> ...almost like how-to example.
>
> But, it is not working...After handling the form action always I am
> redirected to the Insert.vm page (intake.isAllValid() returns always
> true), though the form was not full, what is not accordancing with the
> rules! And the form data are always null!!!
>
> My question is: What is going on?
> Help me....:-(
>
> --
>
>  Leksiu                          mailto:mleks@zeus.polsl.gliwice.pl
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>