View Full Version : Where is the formatting for form buttons?
Infernette
06-17-2015, 08:04 PM
I need to remove the <br>'s that are automagically placed after buttons in forms; what file handles their formatting? I checked the classes for form and button as well as the css files, and didn't find anything on formatting for the buttons. I haven't actively meddled in forms up until now but my current project requires some mild edits...
Kyttias
06-17-2015, 09:13 PM
I'll ask HoF directly about this, but the fastest solution I can think of is to find where the form is being built. You might find something like:
$profileForm->add(new Button("Save Changes", "submit", "submit"));
Which is rendering something like this:
<button id="submit" value="submit" class="btn" name="submit" type="submit">Save Changes
</button>
<br>
I would take it and change it from adding a new Button to adding a new Comment instead, and instead include the html I want rendered exactly (being sure to use single quotes ' inside of double quotes " otherwise things go haywire):
$profileForm->add(new Comment("<button id='submit' value='submit' class='btn' name='submit' type='submit'>Save Changes</button>", FALSE));
Normally, Comments also have linebreaks after them, but setting a final parameter of FALSE negates this. I can't seem to find anything similar to negate the addition of a linebreak after other elements. =T
Infernette
06-17-2015, 09:53 PM
Yep! Thank you. I'll still keep searching for all of the locations since I want to know where its rendering for later purposes. :)
Hall of Famer
06-17-2015, 09:57 PM
The better way to do this is as follows:
$submit = new Button("Save Changes", "submit", "submit");
$submit->setLineBreak(FALSE);
$profileForm->add($submit);
But of course, Kyttias' approach will work too.
Infernette
06-18-2015, 06:47 PM
That could be useful; thanks!
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.