Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchForm does not work (example below with cut and paste) #87

Open
AntonMezger opened this issue Aug 19, 2018 · 16 comments
Open

SearchForm does not work (example below with cut and paste) #87

AntonMezger opened this issue Aug 19, 2018 · 16 comments

Comments

@AntonMezger
Copy link

All my xml files work correctly with mkforms, however an xml file with a searchform refuses to render and tells me "Leider ist ein Fehler aufgetreten). The xml file was developed with formidable and probably something has to be changed I guess.

<meta>
	<name>searchform</name>
	<form formid="searchform" />
              <debug>false</debug>
              <codebehind name="cb" path="fileadmin/xml/cb/class.exportxls.php" />
              <codebehind name="cb1" path="fileadmin/xml/cb/class.userfunctions.php" />
</meta>

<control>
	<datasource:DB name="mytable">
			<sql>
				<userobj>
					<php><![CDATA[
                          $superuser="Superuser";
                          if(in_array($superuser, $GLOBALS['TSFE']->fe_user->groupData['title'])){
                               return 'SELECT * FROM mytable';
                          } else {                               
			return 'SELECT * FROM mytable 
				WHERE association = ' ."'" . $GLOBALS["TSFE"]->fe_user->user["username"] ."'";
                          }	
		                          ]]></php>
				</userobj>
			</sql>	
	</datasource:DB>

</control>

<elements>

	<renderlet:BOX name="mybrand" mode="h2">
		<html>
			<userobj>
				<php><![CDATA[

// en=0 de=2 fr=3 it=5
switch ($GLOBALS['TSFE']->sys_language_uid) {
case 0:
$html = "Actual user: " . $GLOBALS["TSFE"]->fe_user->user["username"];
break;
case 2:
$html = "Aktueller Benutzer: " . $GLOBALS["TSFE"]->fe_user->user["username"];
break;
case 3:
$html = "Utilisateur actuel: " . $GLOBALS["TSFE"]->fe_user->user["username"];
break;
case 5:
$html = "Utente corrente: " . $GLOBALS["TSFE"]->fe_user->user["username"];
break;
}
return $html;
]]>


</renderlet:BOX>

              <renderlet:BOX name="boxMessage" mode="H1" />

	<renderlet:SEARCHFORM name="mysearch">
		<datasource use="mytable" />
		<childs>

                               <template>
                                    <path>fileadmin/xml/template/form_search.html</path>
                               </template>

			<renderlet:TEXT name="association" class="tb2">
                                         <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.association.label</label>
			</renderlet:TEXT>

			<renderlet:TEXT name="berater" class="tb2">
                                         <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.name.label</label>
			</renderlet:TEXT>

			<renderlet:TEXT name="patient" class="tb2">
                                         <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.patient.label</label>
			</renderlet:TEXT>

	                 <renderlet:LISTBOX name="year">
		           <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.year.label</label>
		          <data>
			   <items>
				<item caption="" value=""/>
				<item caption="2007" value="2007"/>
				<item caption="2008" value="2008"/>
				<item caption="2009" value="2009"/>
				<item caption="2010" value="2010"/>
				<item caption="2011" value="2011"/>
				<item caption="2012" value="2012"/>
				<item caption="2013" value="2013"/>
				<item caption="2014" value="2014"/>
				<item caption="2015" value="2015"/>
				<item caption="2016" value="2016"/>
				<item caption="2017" value="2017"/>
				<item caption="2018" value="2018"/>
				<item caption="2019" value="2019"/>
				<item caption="2020" value="2020"/>
			   </items>
		         </data>
	              </renderlet:LISTBOX>

                             <renderlet:DATE  name="datefrom"  class="tb2" activeListable="false" >
                                    <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.datefrom.label</label>
                                    <data>
                                             <datetime format="%d-%m-%y" locale="fr_FR"  allowmanualedition="true" displaytime="false" convertToTimestamp="false" />
                                    </data>
                            </renderlet:DATE> 

                            <renderlet:DATE  name="dateto"  class="tb2" activeListable="false" >
                                    <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.dateto.label</label>
                                    <data>
                                             <datetime format="%d-%m-%y" locale="fr_FR"  allowmanualedition="true" displaytime="false" convertToTimestamp="false" />
                                    </data>
                           </renderlet:DATE> 

	<renderlet:BUTTON name="exportexcel1">
                       <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.export1.label</label>
		<onclick runat="server" exec="cb.doExport()"  params="1" when="before-render"/>
	</renderlet:BUTTON>

	<renderlet:BUTTON name="exportexcel2">
                       <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.export2.label</label>
		<onclick runat="server" exec="cb.doExport()"  params="2" when="before-render"/>
	</renderlet:BUTTON>

	<renderlet:BUTTON name="print">
                       <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.pdf.label</label>
		<onclick runat="server" exec="cb.doPrint()"  when="before-render"/>
	</renderlet:BUTTON>

	<renderlet:BUTTON name="btnClear" >
                      <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.resetform.label</label>
				<onclick runat="client">
					<userobj>
						<php><![CDATA[
							
                                                       $aTasks = array();
                                                       $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["datefrom"]->majixClearValue();
                                                            $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["dateto"]->majixClearValue();
                                                            $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["year"]->majixClearValue();
                                                            $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["patient"]->majixClearValue();
                                                            $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["association"]->majixClearValue();
                                                            $aTasks[] = $this->aORenderlets["mysearch"]->aChilds["berater"]->majixClearValue();
                                                        return $aTasks;

						]]></php>
					</userobj>
				</onclick>
			</renderlet:BUTTON>

              <renderlet:SUBMIT name="btnSearch" mode="search" >
                   <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.search.label</label>
              </renderlet:SUBMIT>

		</childs>
	</renderlet:SEARCHFORM>

	<renderlet:LISTER name="pages" ajaxLister="true">
		<ifEmpty>Empty</ifEmpty>
		<searchform use="mysearch" />
		<pager>
			<rows perpage="10" />
                                 <sort column="uid"  direction="DESC"/>
		</pager>
		<columns>
			<column type="renderlet:LINK" name="uid" listHeader="id" >
				<url>
					<userobj>
						<php><![CDATA[
                                                               return "index.php?id=80&uid=".$this->getListData('uid')."&L=".$GLOBALS['TSFE']->sys_language_uid;
						]]></php>
					</userobj>
				</url>
                                </column>
			<column type="renderlet:TEXT" name="association" listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.association.label" />
			<column type="renderlet:TEXT" name="berater"  listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.name.label"/>
			<column type="renderlet:LISTBOX" name="zielerreichung" listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.label">
				<data>
					<items>
                                                 <item><value>-1</value>
                                                     <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items0</caption>
                                                 </item>
                                                 <item><value>1</value>
                                                     <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items1</caption>
                                                 </item>
                                                 <item><value>2</value>
                                                     <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items2</caption>
                                                 </item>
                                                 <item><value>3</value>
                                                     <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items3</caption>
                                                 </item>
                                                 <item><value>4</value>
                                                     <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items4</caption>
                                                  </item>
                                                  <item><value>5</value>
                                                      <caption>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.ziel.data.items5</caption>
                                                  </item>
                                                   </items>
				</data>
			</column>
                                <column type="renderlet:TEXTAREA" defaultWrap="false" name="Text"  listHeader="Text"/>
                                <column type="renderlet:TEXT" name="year" listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.year.label" />
                                <column type="renderlet:TEXT" name="patient" listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.patient.label" />
			
                                        <column type="renderlet:DATE" name="beratungsdatum" listHeader="LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.dateberatung.label" >
				<data>
					<datetime format="%d-%m-%Y" />
				</data>
			</column>

                                <column type="renderlet:BUTTON" name="btn-del"  listHeader=""  class="delete">
                                        <label>LLL:EXT:ameos_formidable/conf/locallang.php:formidable.elements.delete.label</label>
				<onclick
					runat="ajax"
					params="rowData::uid"
					cache="false"
					exec="cb1.btnDelete_click()"
				/>
                                </column>

		</columns>
	</renderlet:LISTER>
              

</elements>
@hannesbochmann
Copy link
Member

Could you please set the extension configuration of rn_base for verbose mayday to true? After this you should see a more verbose error message in place.
Furthermore it would be helpful to install a devlog extension like mklog if that doesn't help.

@AntonMezger
Copy link
Author

AntonMezger commented Aug 20, 2018 via email

@hannesbochmann
Copy link
Member

There seems to be a problem with session handling as $GLOBALS['_SESSION']['ameos_formidable']['applicationdata'] is no array. Could you please check if tx_mkforms_session_MixedSessionManager::initializeSessionArray() is invoked before the error occurs and what's the content of $GLOBALS['_SESSION']['ameos_formidable'] at the start and the end of this method?
You could also check if the problem occurs with older versions of mkforms. After 3.0.14 there were some changes to the session handling. Maybe it works 3.0.14 which would lead us in the right direction.

@AntonMezger
Copy link
Author

AntonMezger commented Aug 20, 2018 via email

@AntonMezger
Copy link
Author

AntonMezger commented Aug 20, 2018 via email

@hannesbochmann
Copy link
Member

You don't need to invoke that method, mkforms should take care of that. It's done for example when tx_mkforms_session_MixedSessionManager is instantiated (check the constrcutor).
You should only go back to an older version to check at which point the functionality broke. My guess is that it will work with mkforms 3.0.14. With that in mind it would be much more easy to track down the problem.

@AntonMezger
Copy link
Author

AntonMezger commented Aug 20, 2018 via email

@hannesbochmann
Copy link
Member

The new error is due to an error in your xml. The configuration of your SEARCHFORM renderlet should be outside the node.
As I thought the changes after version 3.0.14 introduced this bug. But I'm afraid we don't have time to investigate and fix it right now. Are you willing to dig deeper and provide a pull request?

@AntonMezger
Copy link
Author

AntonMezger commented Aug 20, 2018 via email

@hannesbochmann
Copy link
Member

Sorry, I misunderstood something. Your XML structure seems to be fine. But you need to configure thwe property for the property of your searchform renderlet like this:

fileadmin/xml/template/form_search.html
SEARCH_FORM_RENDERLET

Maybe you need to wrap the subpart with "###" like ###SEARCH_FORM_RENDERLET###. I don't know at the moment. Of course you need the supply this subpart in your template as well.

@AntonMezger
Copy link
Author

AntonMezger commented Aug 20, 2018 via email

@hannesbochmann
Copy link
Member

Considering ameos_feuser_mgr I can't help you with an advice.

@AntonMezger
Copy link
Author

search form is rendered

@digedag
Copy link
Contributor

digedag commented Mar 14, 2019

According to comments in #100 the problem still exists in current head. So I reopen this ticket.

@digedag digedag reopened this Mar 14, 2019
@digedag
Copy link
Contributor

digedag commented Mar 14, 2019

Hey @AntonMezger ,
I tried to install the form xml from ticket description. This fails for some missing code behind and html templates. Also a database query to mytable isn't possible.

So I stripped down your example and got the search form visible. This works and $GLOBALS['_SESSION']['ameos_formidable']['applicationdata'] is filled. There is also no error when I click at Senden. The session data is filled as expected.
So maybe the problem is related to your custom php code.

It would be really helpful if you could provide a (not) working xml example.

@AntonMezger
Copy link
Author

AntonMezger commented Mar 14, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants