You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by SUSHI Team <su...@berlin.de> on 2002/08/28 19:26:33 UTC

intake problem

Hi!

I have a problem with the intake service.
I read the tutorial and I did the same in our application (I think...). But the test of our entries never fails, whether some fields are blank. We are able to get the correct group into the template and into the action class. But when we want to get a field from this group we always get null. We think thats why intake.isAllValid() is always true, but it should not.

our intake.xml:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
<!DOCTYPE input-data SYSTEM
          "http://jakarta.apache.org/turbine/dtd/intake.dtd">

<!-- PUBLIC "-//Apache//Apache-Turbine-Intake Application Data//EN" -->

<!-- ==================================================================== -->
<!--                                                                      -->
<!--                P R O J E C T  I N P U T S                            -->
<!--                                                                      -->
<!-- ==================================================================== -->
<!-- This is an example.                      .                           -->
<!-- ==================================================================== -->

<input-data basePackage="de.tuberlin.cs.cis.curriculum">

<group name="GlobalGroup" key="userKey">

  <field name="UserName" key="userNameKey" type="String">
   <rule name="minLength" value="1">Please enter a user name</rule>
   <rule name="minLength" value="4">Your user name must have at least 4 characters</rule>
  </field>
  <field name="FirstName" key="firstNameKey" type="String">
   <rule name="minLength" value="1">Please enter your first name</rule>
  </field>
  <field name="LastName" key="lastNameKey" type="String">
   <rule name="minLength" value="1">Please enter your last name</rule>
  </field>
  <field name="Email" key="emailKey" type="String">
   <rule name="minLength" value="1">Please enter an email address</rule>
   <rule name="mask" value=".+@.+\..+">Please enter a valid email address</rule>
  </field>
  <field name="Password" key="passwordKey" type="String">
   <rule name="minLength" value="1">Please enter a password</rule>
  </field>
  <field name="RePassword" key="rePasswordKey" type="String">
   <rule name="minLength" value="1">Please re-enter your password</rule>
   <rule name="minLength" value="4">Your password must have at least 4 characters</rule>
  </field>
  <field name="CellPhoneNumber" key="phoneKey" type="String">
  </field>
  <field name="FirstSemester" key="firstSemesterKey" type="String">
  </field>
  <field name="ExaminationStatute" key="statuteKey" type="String">
  </field>
  <field name="Faculty" key="facultyKey" type="String">
  </field>
  <field name="University" key="uniKey" type="String">
  </field>
</group>

</input-data>


our template:
<form method="post" action="$link.setAction("global.GlobalActionEvents").setPage("global,UserDetails.vm")">
##<form method="post" action="$link.setPage("global,UserDetails.vm")">
#if ($data.getACL().hasRole("Anonymous"))
 $page.setTitle("$SignUp_Titel - ")

  ##Intake
  #set ( $UserGroup = $intake.GlobalGroup.Default )

  <table border=0>
   <tr>
     <td colspan=3 align="center">
        <font face="$ui.sansSerifFonts">
	 $lblText
	 #if ( !$UserGroup.UserName.isValid() )
	  <br> $UserGroup.UserName.Message
	 #end
	 #if ( !$UserGroup.FirstName.isValid() )
	  <br> $UserGroup.FirstName.Message
	 #end
	 #if ( !$UserGroup.LastName.isValid() )
	  <br> $UserGroup.LastName.Message
	 #end
	 #if ( !$UserGroup.Email.isValid() )
	  <br> $UserGroup.Email.Message
	 #end
 	 #if ( !$UserGroup.Password.isValid() )
	  <br> $UserGroup.Password.Message
	 #end
	 #if ( !$UserGroup.RePassword.isValid() )
	  <br> $UserGroup.RePassword.Message
	 #end
	 #if ( !$UserGroup.CellPhoneNumber.isValid() )
	  <br> $UserGroup.CellPhoneNumber.Message
	 #end
	 #if ( !$UserGroup.FirstSemester.isValid() )
	  <br> $UserGroup.FirstSemester.Message
	 #end
	 #if ( !$UserGroup.ExaminationStatute.isValid() )
	  <br> $UserGroup.ExaminationStatute.Message
	 #end
	 #if ( !$UserGroup.Faculty.isValid() )
	  <br> $UserGroup.Faculty.Message
	 #end
	 #if ( !$UserGroup.University.isValid() )
	  <br> $UserGroup.University.Message
	 #end

	</font>
	</td>
    </tr>
    <tr>
     #if ( !$UserGroup.UserName.isValid() ) <td style="background-color:#FF0000;"> -> #else <td> #end </td>
     #formCell ("! $lblUserName" "UserName" "$!UserGroup.UserName")
    </tr>
    <tr>
     #if ( !$UserGroup.FirstName.isValid() ) <td style="background-color:#FF0000;"> -> #else <td> #end </td>
     #formCell ("! $lblFirstName" "FirstName" "")

    </tr>
.....

our action class:
public void doSignup(RunData data, Context context) {
        int studentData;
        TurbineUser tu = new TurbineUser();
        Student stu = new Student();
        ParameterParser pp = data.getParameters();
        String email = pp.getString("Email");
        
        try {
            if(data.getACL().hasPermission("Sign Up")) {

            	IntakeTool intake = (IntakeTool) context.get("intake");    

            	org.apache.turbine.services.intake.model.Group grp =
		intake.get("GlobalGroup", IntakeTool.DEFAULT_KEY);
	
		Field fld = grp.get("UserName");
	
		Log.info("GlobalActionEvents", "Intake Msg : "+ fld.getMessage() );
	        //This String is always empty!!!!!!!!!


		if(!intake.isAllValid()) {
                // This test is always true!!!!!!!!!!!!
		Log.info("GlobalActionEvents", "intake und gruppenobjekt NICHT OK.");
				return;
		}
......

Thanks for your help,
Alexander Heinze
--
berlin.de - meine stadt im netz. Jetzt eigene eMail-adresse @berlin.de sichern!
http://webmail.berlin.de


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