[TYPO3-dev] enforcement of uniqueness of fields

Jochen Rieger j.rieger at connecta.ag
Fri Apr 21 22:07:19 CEST 2006


Hi Martin, Markus and Kasper,

> Maybe only the warning could be presented to the user. But I don't think 
> that an AJAX check is harder to implement.

as I also ran into that problem I decided to develop an AJAX check.


My concept:

If a field is supposed to be unique or uniqueInPid I am adding an 
eventhandler (onkeyup) to the <input> field to trigger the AJAX request. 
Beside that I am adding a <span> behind the <input> field where the 
warning message is to be displayed in case the actual field value 
already exists in the DB table / on the page.

Unfortunately I do not have too much core-knowledge yet. So I might need 
some advice. What I figured out so far:

- class.t3lib_tceforms.php needs to be edited from around line 1000
- I am adding JS code via $this->additionalJS_pre[]
- I try to use the methods of class.t3lib_ajax.php


My questions / issues:

1) Where to put the PHP code that is called by the AJAX request and 
checking against DB? In an own file? Into an existing one? Maybe we 
should create a general AJAX-response class that gets an action parameter?

2) If t3lib_ajax::getJScode() is called several times within a page (as 
is the case in alt_doc.php when editing records) then the basic 
functions will get overwritten all the time. Not very nice, isn't it? 
Might lead to problems also.

Any advice / hint is highly appreciated.

Have a nice week-end,
Jochen

-- 
:: innovative it-strategies ::
::                          ::
:: www.connecta.ag          ::




More information about the TYPO3-dev mailing list