[TYPO3-project-formidable] problem with own table on CRUD Example

orta ortakoey at googlemail.com
Tue May 27 17:14:35 CEST 2008


Hi,
ich changed the CRUD example to my own table tbl_team.
Everything seems to be work, but if i press the EDIT Button on the 
lister, i get the wrong table_uid(For Example UID=22). Sometimes nothing 
happens, if click the EDIT Button(For Example UID=21 or 20).
You can see it here:
http://www.amafu.de/tvweb_3_3/index.php?id=134

I use Rev. 183.
The formidable version and the xmlns are different to my Rev., is that 
important? The origin CRUD works fine:
http://www.amafu.de/tvweb_3_3/index.php?id=129
thx,
orta

On CRUD I deleted this in the <datahandler:DB>, because i dont need it:
####
// Inserting sysfields in array going to DB
if($this->oDataHandler->_creation()) {
$aData["crdate"] = time();							$aData["pid"] = $GLOBALS["TSFE"]->id;
$aData["cruser_id"] = $GLOBALS["TSFE"]->fe_user->user["uid"];
			}
$aData["tstamp"] = time();
####

This is my table:
########
CREATE TABLE tbl_team (
team_uid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
team_name VARCHAR(50) NOT NULL,
team_image VARCHAR(100) NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8;
########

This is my xml:
###############
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<formidable version="0.7.160"
	xmlns:datahandler="http://www.ameos.com/formidable/0.7.160/datahandler"
	xmlns:datasource="http://www.ameos.com/formidable/0.7.160/datasource"
	xmlns:renderer="http://www.ameos.com/formidable/0.7.160/renderer"
	xmlns:renderlet="http://www.ameos.com/formidable/0.7.160/renderlet"
	xmlns:validator="http://www.ameos.com/formidable/0.7.160/validator"
	xmlns:actionlet="http://www.ameos.com/formidable/0.7.160/actionlet">
	
	<meta>
		<name>real-life CRUD example</name>
		<form formid="myform"/>
		<debug>false</debug>
		<displaylabels>true</displaylabels>
	</meta>
	
	<control>
		<datahandler:DB>
			<tablename>tbl_team</tablename>
			<keyname>team_uid</keyname>
			<process>
				<beforeInsertion>
					<userobj>
						<php><![CDATA[/*<?*/
							
							$aData = $this->getUserObjParams();

							return $aData;
					
						/*?>*/]]></php>
					</userobj>
				</beforeInsertion>
			</process>
		</datahandler:DB>

		<renderer:STANDARD/>

		<datasources>
			<datasource:DB name="ds-tbl_team">
				<sql>SELECT * from tbl_team</sql>
			</datasource:DB>
		</datasources>

		<sandbox>
			<userobj>
				<php><![CDATA[/*<?*/
					
					// reusable methods to be used everywhere in xml thru call to 
$this->oSandBox
						// the sandbox can also hold properties as it is an object
						// will also be available and persisted in ajax context, if needed

					function shouldDisplayForm() {
						return (
							$this->oForm->aORenderlets["btn-new"]->_hasThrown("click") ||
							$this->oForm->aORenderlets["btn-save"]->_hasThrown("click") ||
							$this->oForm->oDataHandler->_edition()
						);
					}

					function shouldDisplayList() {
						return !$this->shouldDisplayForm();
					}

				/*?>*/]]></php>
			</userobj>
		</sandbox>
	</control>

	<elements>

		<!-- the button NEW, submit mode is CLEAR -->
		<renderlet:SUBMIT name="btn-new" label="New" mode="clear" />


		<!-- the LISTER boud to datasource tbl_team, whose display is 
conditionned -->
		<renderlet:LISTER name="my-list">
			<process>
				<userobj>
					<php><![CDATA[/*<?*/
						
						return $this->oSandBox->shouldDisplayList();
				
					/*?>*/]]></php>
				</userobj>
			</process>
			<datasource use="ds-tbl_team" />
			<pager>
				<sort column="team_uid" direction="desc" />
			</pager>
			<columns>
				<column type="renderlet:TEXT" name="team_uid" listHeader="TEAM UID" />
				<column type="renderlet:TEXT" name="team_name" listHeader="TEAM NAME" />
				<column type="renderlet:BUTTON" name="btn-edit" listHeader="BUTTON" 
label="Edit">
					<onclick runat="client">
						<userobj>
							<php><![CDATA[/*<?*/
								
								$aRow = $this->oDataHandler->getListData();
								return $this->majixRequestEdition($aRow["team_uid"]);
						
							/*?>*/]]></php>
						</userobj>
					</onclick>
				</column>
			
			</columns>
		</renderlet:LISTER>

		<!-- the EDIT/CREATE FORM container -->
		<renderlet:BOX name="edition-box">
			<process>
				<userobj>
					<php><![CDATA[/*<?*/
						
						return $this->oSandBox->shouldDisplayForm();
				
					/*?>*/]]></php>
				</userobj>
			</process>
			<childs>
				<renderlet:BOX mode="h2">
					<html>
						<userobj>
							<php><![CDATA[/*<?*/
								
								if($this->oDataHandler->_edition()) {
									return "Edit page";
								} else {
									return "Create page";
								}
						
							/*?>*/]]></php>
						</userobj>
					</html>
				</renderlet:BOX>

         <renderlet:TEXT name="team_uid" label="TEAM UID:"/>
				<renderlet:TEXT name="team_name" label="TEAM NAME:***">
					<validators>
						<validator:STANDARD>
							<required message="TEAM NAME is required" />
						</validator:STANDARD>
					</validators>
				</renderlet:TEXT>

				<renderlet:SUBMIT name="btn-save" label="Save" />
				<renderlet:SUBMIT name="btn-close" label="Close" mode="clear" />
			</childs>
		</renderlet:BOX>

	</elements>

</formidable>
###############


More information about the TYPO3-project-formidable mailing list