Bug #14262
closedUsing input type="image" does not trigger $TSFE->checkDataSubmission()
0%
Description
When using input type="image" in a mailform the HTTP_POST_VARS array does not contain a key named formtype_mail, but two keys named formtype_mail_x and formtype_mail_y
These keys are not checked, thus no mail is sent from a form.
Either patch index.php in the root with:
if ($HTTP_POST_VARS['formtype_mail_x'] || $HTTP_POST_VARS['formtype_mail_y']) {
$HTTP_POST_VARS['formtype_mail'] = 1;
}
or patch tslib/class.tslib_fe.php in this manner.
(issue imported from #M264)
Updated by Ingmar Schlecht over 20 years ago
I don't really understand why there is a difference between <input type="image"> and <input type="submit">. Could you explain that please?
Updated by old_leening over 20 years ago
I don't really understand why i have to explain the difference between <input type="image"> and <input type="submit"> :-)
There IS a difference. There has been a difference between them ever since HTML 1
Please try the following an let's not talk about the why and what of HTML, it's rather OT.
As you can see when this code is run, there is never a posted variable named "image_submit". That's the problem. Have you tried it in T3? No? Please do so and you can see what I mean.
<form name="formName" method="post">
text: <input type="text" name="name" value="test" /><br />
<input type="submit" name="button_submit" value="Submit" /><br />
<input type="image" name="image_submit" src="http://images.google.com/images?q=tbn:ET6w3oWnwmsJ:eclipse.cps.k12.va.us/spyker/staff/images/submit.gif" />
</form>
if (count($_POST)) {
print '<xmp>';
print_r($_POST);
print '</xmp>';
}
?>
Updated by Dmitriy Larionov almost 19 years ago
In function checkDataSubmission() in /tslib/class.tslib_fe.php
line 1870, instead of
if ($_POST['formtype_db'] || $_POST['formtype_mail']) {
use
if ($_POST['formtype_db'] || $_POST['formtype_mail'] || ($_POST['subject'] && $_POST['recipient'])) {
line 1875, instead of
if ($_POST['formtype_mail']) {
use
if ($_POST['formtype_mail'] || ($_POST['subject'] && $_POST['recipient'])) {
the problem with 'FORMTYPE_MAIL_X' and 'FORMTYPE_MAIL_Y' is that $_POST['FORMTYPE_MAIL_X'] and $_POST['FORMTYPE_MAIL_Y'] on the stage of this checks (i think) does not exists, at least we can't check it in POST.
Updated by Jigal van Hemert over 14 years ago
Tested in 4.4-trunk, code checked in 4.3.3 and 4.2.12
If the submit button or image has the name formtype_db or formtype_mail the .._x variations are also detected properly.
So, cannot be reproduced anymore.
Updated by Chris topher over 14 years ago
Thanks for the note, Jigal!
Resolved as duplicate of #14925, which fixed this problem in revision 1473.