Feature #14525
closedFORM cObj can't add a "reset" button
0%
Description
Currently there is no possibility to add the following code to a form:
<input type="reset" value="Reset form">
(issue imported from #M743)
Files
Updated by Michael Scharkow almost 20 years ago
Added a patch which seems to do the trick. It's mainly a copy'n'past hack, but nevertheless. Maybe it's really that easy ;)
Tested with this form config line, not from TS (should possibly work as well):
reset | test=reset | Reset form
Updated by Michael Stucki almost 20 years ago
Thanks for that patch, Michael!
The config line should be the same like for the Submit button:
(From TSref:)
submit: Label |[fieldname =]submit | Caption
And for the upcoming reset button:
reset: Label |[fieldname =]reset | Caption
The label (some text, left to the button) and the fieldname must both be optional.
Does this work that way already?
(I didn't check if your patch already works that way. Eventually I will do that on my own later, so this is just for the records...)
edited on: 04.02.05 00:41
Updated by Michael Scharkow almost 20 years ago
| =reset | Reset form
also works as expected for me. This is because it's basically the same as the submit button (without the image property, do we need this for the reset buton?)
Updated by Michael Stucki almost 20 years ago
The "=" should not be needed - was this just a typo?
If the image property is available for submit buttons then it should be the same here.
Updated by Michael Scharkow almost 20 years ago
it works without =, actually I have never used the mailform element so I didn't know the syntax ;) And, according to http://www.htmlcodetutorial.com/forms/index_famsupp_142.html and other sites , the image works only for submit buttons, so leaving it out is adhering to the html specs.
Updated by old_bbowser over 19 years ago
I'm not having as much luck getting this hack to work. I've added the suggested line of text (reset |test=reset| Reset form) to the Configuration area in the Mailform pagecontent element with the rest of the configuration code. But nothing is generated on the page. I also tried:
|reset| Reset form
and
|formtype_mail = reset| Reset form
(this is the same format as my submit value)
Is there something else I need to do?
Updated by old_bbowser over 19 years ago
That would certainly help, wouldn't it?
<sheepish grin>
Still learning how all this works.
Thanks for the reminder
Updated by old_mstephenson over 19 years ago
BBowser,
Hopefully, this will help provide the additional detail that you need. I applied the patch to the my site and it seems to work.
You must edit the typo3 source file:
tslib/class.tslib_content.php
Starting at line 1778, you add the lines with a + in them below:
[quote]$confData['fieldname'], t3lib_div::deHSCentities(htmlspecialchars($value)));
}
break;
+ case 'reset':
+ $value=trim($parts2);
+ $fieldCode=sprintf('<input type="reset" name="%s"'.$elementIdAttribute.' value="%s"'.$addParams.' />',
+ $confData['fieldname'], t3lib_div::deHSCentities(htmlspecialchars($value)));
+ break;
+
case 'label':
$fieldCode = nl2br(htmlspecialchars(trim($parts2)));
break;[/quote]
It is a pain because it is hard to edit this file and the file is huge. I used Quixplorer and downloaded it, edited it, and uploaded it. I also copied the original file just in case I needed to restore it.
So that is the patch. Now, in the actual form, you need to add:
| formtype_mail=reset | BBowser Reset
This patch works functions, but is not complete. If you use the form editor then the editor gets confused by this code. So, for the best results, create the entire form and then add | formtype_mail=reset | BBowser Reset manually.
I hope this helps.
Mark