Task #17626
closed
JS-function checkSubmit should not use eval
Added by Mads Brunn about 17 years ago.
Updated about 7 years ago.
Category:
FormEngine aka TCEforms
Description
The checkSubmit function in typo3/jsfunc.tbe_editor.js (used in backend forms) is in IMHO not correctly implemented.
The lines 260-264 checks if any user-defined javascript (registered with t3lib_tceforms->additionalJS_submit) should be evaluated before the form is submitted.
But it uses the eval-function to execute the javascript and this means that you cannot abort the submit in your own javascript-code (using "return false;") .
(issue imported from #M6392)
Hi,
what do you mean with "abort the submit in your own javascript-code"? Could you please give an example?
We cound integrate another check before line 266, e.g.
if (STOP) {
return false;
}
So, you can add e.g. the following to t3lib_TCEforms->additionalJS_submit:
if (!MyValidatorObject.someFunction()) {
STOP = true;
}
Hi,
Yes, that's exactly what I had in mind.
I want e.g. to do a check on a specific field and if it doesn't have a specific value the submit should be aborted.
Btw. I think this used to work in version 4.0 but back then the code in t3lib_TCEforms->additionalJS_submit was simply injected directly in the onsubmit function.
- Tracker changed from Bug to Feature
- Subject changed from JS-function checkSubmit not correctly implemented to JS-function checkSubmit should not use eval
- Category set to FormEngine aka TCEforms
- Status changed from New to Accepted
- Assignee set to Andreas Wolf
- Target version deleted (
0)
I guess this is more a feature than a bug... But we should definitely have it.
- Assignee changed from Andreas Wolf to Frank Nägler
Could you check during your FormEngine crusade, please?
- Target version set to 7.4 (Backend)
- PHP Version deleted (
4.3)
- Target version changed from 7.4 (Backend) to 7.5
- Target version changed from 7.5 to 7 LTS
- Status changed from Accepted to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43743
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43743
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43743
- Tracker changed from Feature to Task
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/43743
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF