Comments (3)
@SicorDev This one is unfortunately not that easy. The problem is that TYPO3 saves the record on type change. In that cases all validations in the form are skipped, probably because the fields might change with the type change.
I tried to improve the behaviour by removing the empty default option in the domain select, so the redirect would in any case show in in the list and would not disappear. Unfortunately this could also lead to that duplicate key sql error because the url to the homepage has an empty path.
I also made the path
required, so this might help the user to understand, that this field must be filled. But as I said, I currently can't find a way to avoid TYPO3 from saving the record in type change.
I update all 3.x branches. Please try the change and let me know what you think.
from nawork-uri.
@thommyhh
I've tried the current master branch, but I couldn't find any difference in the behaviour.
I've got another idea, how to prevent the error in all cases:
You could add a "afterSaveHook", that sets a default path value, if no value is set.
(Untested example)
ext_tables.php
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'EXT:' . $_EXTKEY . '/Classes/Hooks/Hook.php:Hook';
Hook.php
function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, &$pObj) {
if ($table == 'tx_naworkuri_uri' && $status === 'new') {
if(!$fieldArray['path']) {
$fieldArray['path'] = 'default-value' . time();
}
}
}
from nawork-uri.
@SicorDev The problem is, that the SQL errors occurs when saving, meaning a default value must be set before. On the other hand, it could theoretically be possible to have an empty path. If I remember correctly, the url for the homepage has an empty path, which doesn't really makes sense.
Maybe the fix is, to not allow empty paths at all, and handle an empty path as the homepage. Adding the default value, if the record was saved by the type change with an empty path.
from nawork-uri.
Related Issues (16)
- Documentation HOT 1
- 404 pages for sites with sublanguages HOT 4
- Deprecation warnings HOT 2
- Improve logging HOT 1
- Clearing cache error HOT 2
- Missing explanations HOT 13
- <Append>/</Append> doesn't work HOT 11
- Custom language domains and URL generation HOT 5
- Issues with typoscript_rendering extension from Helmut Hummel HOT 2
- Error when no domain record found HOT 3
- SQL error when creating new sys domain record (TYPO3 8.7)
- Add all parameters avaiable in a configuration
- Improve error handling/logging HOT 1
- SQL Error in Frontend on trying to use nawork-uri in TYPO3 HOT 4
- Non-Admins are not able to use the redirect module HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nawork-uri.