turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Demner" <turb...@demner.com>
Subject RE: Strange intake issue
Date Tue, 20 Jan 2004 04:21:10 GMT
Hi,

I still can't get it.  I've tried a bunch of different things, and none of
it works.  Here's my most recent try:

--- Wizard step 1 ---

  #set ($employeeId = $data.Parameters.EmployeeId)
  #if ($employeeId == "-1")
    #set ($employee = $employeeTool.getEmployeeFromRunData($data))
  #else
    #set ($employee = $employeeTool.getEmployee($employeeId))
  #end
  $employee.FirstName
  #set ($employeeGroup = $intake.Employee.mapTo($employee))
  $employeeGroup.FirstName

*** This works as expected the first time (no data is printed)
*** This does not work as expected the second time on this screen (no data
is printed)
--- Wizard step 2 ---
  #set ($employeeId = $data.Parameters.EmployeeId)
  #if ($employeeId == "-1")
    #set ($employee = $employeeTool.getEmployeeFromRunData($data))
  #else
    #set ($employee = $employeeTool.getEmployee($employeeId))
  #end
  $employee.FirstName
  #set ($employeeGroup = $intake.Employee.mapTo($employee))
  $employeeGroup.FirstName

*** This works as expected ($employee.FirstName and $employeeGroup.FirstName
are set to whatever I entered in step 1)
--- Action ---
        IntakeTool intake = (IntakeTool) context.get("intake");
        // set the properties of the object from all the groups
        Employee employee = new Employee();
        java.util.Map map = intake.getGroups();
        java.util.Iterator iter = map.keySet().iterator();
        while (iter.hasNext()) {
        	log.debug("Doing next group");
        	((Group)map.get(iter.next())).setProperties(employee);
        }
        data.getUser().setTemp("NewEmployee", employee);

*** This does not work as expected - after the first step FirstName is set
to whatever I entered, but after the second step it's always empty
------------

Here's a sampling what I tried so far, none of it works:
- In intake.xml, I've tried making one group for all screens and one group
per screen
- mapTo didn't seem to work the first few times, so I created the group
first, and then used getProperties to set the group's properties to those of
my object. Then I switched back to mapTo and is seemed to work....
- Various different implementations of the Action (not creating new object
but using one from temp hash, specifying the intake group, iterating (as
above), etc)
- Banging my head against a hard surface.

So, as before, any insight is appreciated.

Thanks,

David

-----Original Message-----
From: oron ogdan [mailto:oron.ogdan@netada.co.uk] 
Sent: Friday, January 16, 2004 2:00 AM
To: 'Turbine Users List'
Subject: RE: Strange intake issue


Hi David

I think since intake gathers the info form the form input fields, it's not
surprising step 3 will not show the info, as there is no such filed in step
2. Your best bet would be to mapTo object that you can save on the user's
temp hash on the session.

Oron

http://netada.co.uk


-----Original Message-----
From: David Demner [mailto:turbine@demner.com]
Sent: Friday, January 16, 2004 6:00 AM
To: turbine-user@jakarta.apache.org
Subject: Strange intake issue


I would like to create a 'wizard' using intake to do the input validation
after each step of the wizard.  I currently have the same intake group to
hold all the data from the wizard (since I would like to store all the data
in one table).  I'm having a weird issue, though.

First, some background code:

--------
Wizard step 1:
<form name="employee" method="post"
action="$link.setPage("screens,Employee2.vm")">
  #set ($employeeGroup = $intake.Employee.Default)

  <input type="text" size="35" name="$employeeGroup.FirstName.Key"
value="$!employeeGroup.FirstName" class="smallIO">
  <input type="submit" name="eventSubmit_doNext" value="Next >>"/>

  $intake.declareGroups()

</form>
---------
Wizard steps 2 & 3:
<form name="employee" method="post"
action="$link.setPage("screens,Employee3.vm")">

  #set ($employeeGroup = $intake.Employee.Default)

  here $employeeGroup.FirstName here
  <input type="submit" name="eventSubmit_doNext" value="Next >>"/>

  $intake.declareGroups()
</form>
-----------
When I click Next to go to step 2, the $employeeGroup.FirstName is populated
to whatever I set in step 1.  But when I click next to go to step 3, the
$employeeGroup.FirstName is blank.  So what happens to it??  I would have
thought that either data would not show up in either step (showing that
intake wasn't really designed for this), or show up in both.

(I thought of using hidden fields to store the data that isn't on the
current form, but the problem I have is some of the data in steps 2 & 3 is
required, so intake gives an error after step 1 for data in step 2)

Can you see something dumb that I did?  What do other people do for a
validated wizard type interface?

Thanks!

David



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



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


Mime
View raw message