I have been trying to use <button> instead of <input> tags for form submissions, but also wanted to be able to add a <span> tag within the <button> tag to have more options with CSS styling
After searching through code in the Sapphire framework I found that the tags are build in FormField.php starting on line 495. I changed the code on line 502 to look as follows
if($content || $tag != 'input') {
if($tag == 'button'){
return "<$tag$preparedAttributes><span>$content</span></$tag>";
} else {
return "<$tag$preparedAttributes>$content</$tag>";
}
}
So everything seemed to work just right, until I logged into the CMS and discovered that now the buttons for "unpublish", "save". "save and publish", etc. are no longer working.
I assume that Javascript (I don't know very much about Javascript and AJAX) is no longer able to get to the content of the button because of the <span> tag. If my assumption is correct, is there a possibility to check within the PHP code if these buttons are used in the CMS and not the front end, so that the <span> tags would not be written out?
Thanks so much