I am using twitter bootstrap to style my admin panels, however this is very strange behavior. I've tested in Chrome 28 and Firefox and it messes up grid when I add a simple hidden input.
If you move hidden input into div.span6 or remove it completely it will work as intended, but if it stays there the rows collapse and do not work properly. By properly I mean that they should be next to each other, not on top.
Fiddle: http://jsfiddle.net/EZMvB/
<div class="container-fluid">
<form action="/admin/category/create" class="row-fluid" method="post">
<input type="hidden" name="WAT" value="WAT" />
<div class="span6">
<label for="NameEnglish">Name (English)</label>
<input class="input-block-level" name="NameEnglish" type="text">
</div>
<div class="span6">
<label for="NameEnglish">Name (English)</label>
<input class="input-block-level" name="NameEnglish" type="text">
</div>
<input type="submit" value="Create" class="btn btn-large btn-primary pull-right">
</form>
</div>
Putting class row-fluid in <form> tag in general is bad practice, because you always end up with one row, where as you could end up needing more then one row in your code.
Example here in jsFiddle
Code:
<form action="/admin/category/create" method="post" novalidate="novalidate">
<input type="hidden" />
<div class="row-fluid" >
<div class="span6">
<label for="NameEnglish">Name (English)</label>
<input class="input-block-level" data-val="true" data-val-required="'Name English' should not be empty." id="NameEnglish" name="NameEnglish" type="text" value="">
</div>
<div class="span6">
<label for="NameEnglish">Name (English)</label>
<input class="input-block-level" id="NameEnglish" name="NameEnglish" type="text" value="">
</div>
<input type="submit" value="Create" class="btn btn-large btn-primary pull-right">
</div>
</form>
Seems to work as desired if you move the hidden field (http://jsfiddle.net/EZMvB/1/). Not sure why placement matters since the default style of display: none should prevent it from affecting layout?
<div class="container-fluid">
<form action="/admin/category/create" class="row-fluid" method="post">
<div class="span6">
<label for="NameEnglish">Name (English)</label>
<input class="input-block-level" name="NameEnglish" type="text">
</div>
<div class="span6">
<label for="NameEnglish">Name (English)</label>
<input class="input-block-level" name="NameEnglish" type="text">
</div>
<input type="submit" value="Create" class="btn btn-large btn-primary pull-right">
<input type="hidden" name="WAT" value="WAT" />
</form>
</div>
Related
Having a problem with getting the items of the following code vertically aligned with bootstrap 4. Before the addition of the row they are all stacked but revert to being horizontally in-line when the "row" or "row align-items-start" classes are added.
<div class="container">
<div class="row align-items-start">
<h1></h1>
<form action="" method="POST">
<input class="form-control" type="text" name="name" placeholder="name">
<input class="form-control" type="text" name="name" placeholder="image URL">
<button class="btn btn-dark">
Submit!
</button>
</form>
Go Back
</div>
</div>
You need to specify a column, see example.
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1></h1>
<form action="" method="POST">
<input class="form-control" type="text" name="name" placeholder="name">
<input class="form-control" type="text" name="name" placeholder="image URL">
<button class="btn btn-dark">
Submit!
</button>
</form>
Go Back
</div>
</div>
</div>
I am trying to add a delete button on the right of bootstrap panel. No matter what I do it is not getting inline with panel heading. Help please.
<div class="panel-heading">
Update Article
<form class="delete_form pull-right" id="delete_form" method="post" action="" enctype="multipart/form-data">
<input type="submit" name="submit" class="btn btn-danger" value="Delete" onclick="return confirm(\'Are you sure you want to delete this item?\');" />
</form>
</div>
Edit 1: Added rest of the panel code.
<div class="panel-body">
<form class="article_form" id="article_form" enctype="multipart/form-data">
<div class="row">
<div class="col-sm-6 form-group">
<label for="title" requiredField>Title*</label>
<input type="text" class="form-control" id="title" value="$title" name="title" maxlength="100" required>
</div>
<div class="col-sm-6 form-group">
<label for="pdf_link">PDF Link*</label>
<input type="text" class="form-control" id="pdf_link" value="$pdfurl" name="pdf_link" maxlength="100" required>
</div>
</div>
<div class="row">
<div class="word_file col-sm-6 form-group">
<label>Upload Microsoft Word file of the article.</label>
<input class="form-control" accept=".doc, .docx" type="file" id="word_file" name="word_file">
</div>
<div class="word_unavailable col-sm-6 form-group">
<label for="ur_name">Check if Microsoft Word file is unavailable.</label>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="chk_word" name="chk_word">
<label class="form-check-label" for="wordfiles">MS Word file is unavilable</label>
</div>
</div>
</div>
<input type="submit" name="submit" class="btn btn-primary" value="Update" />
</form>
</div>
</div>
I am not using any custom css.
Edit 2: Needed results
<body>
<div class="panel panel-default">
<div class="panel-heading container-fluid">Update Article
<form class="pull-right" id="delete_form" method="post" action="" enctype="multipart/form-data">
<input type="submit" name="submit" class="btn btn-danger" value="Delete" onclick="return confirm(\'Are you sure you want to delete this item?\');" />
</form>
</div>
<div class="panel-body">Any content</div>
</div>
</body>
I am a newb to programming, this is my first question here.
I have a bootstrap modal that opens up to a Contact Us form. In Firefox, the form submits postback as expected. In IE 11 clicking the send button just hangs, nothing. The close window buttons work as do the required attributes for text input fields.
I have seen other similar questions, but I am not missing name attributes on any field or button. I am also not duplicating the type="submit" attributes in the tag. I have experimented with using button type="submit" and every other way I can think of doing it. The modal and form elements all work except for the submission. The button behaves as though it is being clicked but nothing changes, nothing is submitted. Any help would be terrific!
Relevant Code:
<form class="form-horizontal" method="post" name="PortalContactUsForm" id="PortalContactUsForm">
<input type="submit" form="PortalContactUsForm" name="SendEmailButton" id="SendEmailButton" class="btn btn-primary" value="Send">
The complete Modal and form code:
<div id="myPortalModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myPortalModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" name="ModalCloseButton" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="myPortalModalLabel">Contact Us</h3>
</div>
<div class="modal-body">
<h4>Send <cfoutput>#sub_merchant.companyname#</cfoutput> an email by filling out the form below.</h4><br>
<form class="form-horizontal" method="post" name="PortalContactUsForm" id="PortalContactUsForm">
<div class="control-group">
<label class="control-label" for="Account" name="lblAccount" id="lblAccount" form="PortalContactUsForm">Account</label>
<div class="controls">
<input type="text" form="PortalContactUsForm" name="Account" id="Account" value="<cfoutput>#customer.account#</cfoutput>" readonly>
</div>
</div>
<div class="control-group">
<label class="control-label" for="FirstName" name="lblFirstName" id="lblFirstName" form="PortalContactUsForm">First Name</label>
<div class="controls">
<input type="text" form="PortalContactUsForm" name="FirstName" id="FirstName" value="<cfoutput>#customer.firstname#</cfoutput>" readonly>
</div>
</div>
<div class="control-group">
<label class="control-label" for="LastName" name="lblLastName" id="lblLastName" form="PortalContactUsForm">Last Name</label>
<div class="controls">
<input type="text" form="PortalContactUsForm" name="LastName" id="LastName" value="<cfoutput>#customer.lastname#</cfoutput>" readonly>
</div>
</div>
<div class="control-group">
<label class="control-label" for="Email" name="lblEmail" id="lblEmail" form="PortalContactUsForm">Your Email</label>
<div class="controls">
<input type="email" form="PortalContactUsForm" name="Email" id="Email" value="<cfoutput>#customer.email#</cfoutput>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="ConfirmEmail" name="lblConfirmEmail" id="lblConfirmEmail" form="PortalContactUsForm">Confirm Email</label>
<div class="controls">
<input type="email" form="PortalContactUsForm" name="ConfirmEmail" id="ConfirmEmail" value="">
</div>
</div>
<div class="control-group">
<label class="control-label" for="PhoneNum" name="lblPhoneNum" id="lblPhoneNum" form="PortalContactUsForm">Your Phone</label>
<div class="controls">
<input type="tel" form="PortalContactUsForm" name="PhoneNum" id="PhoneNum" value="<cfoutput>#customer.phone#</cfoutput>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="MsgBody" name="lblMsgBody" id="lblMsgBody" form="PortalContactUsForm">Questions/Comments</label>
<div class="controls">
<textarea rows="3" form="PortalContactUsForm" name="MsgBody" id="MsgBody" placeholder="No html here, just plain text please." required></textarea>
</div>
</div>
<div class="control-group pull-right">
<label class="checkbox">
<input type="checkbox" form="PortalContactUsForm" name="SendCCCheckbox" id="SendCCCheckbox">
Check this box to receive a copy of this email at the address above.
</label>
</div>
<cfoutput>
<input type="hidden" form="PortalContactUsForm" name="postback" id="postback" value="true">
<input type="hidden" form="PortalContactUsForm" name="mailsend" id="mailsend" value="true">
<input type="hidden" form="PortalContactUsForm" name="lname" id="lname" value="#trim(form.lname)#">
<input type="hidden" form="PortalContactUsForm" name="zip" id="zip" value="#(len(trim(form.zip)) > 5 ? left(trim(replace(form.zip, "-", "", "all")), 5) : trim(form.zip))#">
<input type="hidden" form="PortalContactUsForm" name="pin" id="pin" value="#trim(replacelist(pin, "-, ", ""))#">
</cfoutput>
</form>
</div>
<div class="modal-footer">
<button class="btn" name="CloseModalButton" data-dismiss="modal" aria-hidden="true">Close</button>
<input type="submit" form="PortalContactUsForm" name="SendEmailButton" id="SendEmailButton" class="btn btn-primary" value="Send">
</div>
</div>
I want to align TextBox which will be used as Searchbox and button.
Problem is when I use inline form class on div the textbox is loosing its width.
<div class="col-lg-6">
<input type="text" id="test" name="city" class="form-control input-lg" placeholder="E.g. Manchester">
<div class="form-inline">
<div class="form-group ">
<input type="text" id="city" name="city" class="form-control input-lg" placeholder="E.g. Manchester">
<input type="button" value="Search" class="form-control btn-lg"/>
</div>
</div>
</div>
what I'm missing here..
here is a good solution for you:
Screenshot:
Code:
<div class="form-group">
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="E.g. Manchester" />
</div>
<div class="input-group">
<input type="text" class="form-control" placeholder="E.g. Manchester" />
<span class="input-group-btn">
<button class="btn btn-default" type="button">Search</button>
</span>
</div>
Result:
http://jsfiddle.net/j9EdZ/
You might be best using the col-md-* values here, e.g.:
<div class='col-lg-6'>
<form class='form'>
<div class='row'>
<div class='form-group'>
<div class='col-md-10'>
<input class='form-control input-lg' type='text' placeholder='E.g. Manchester'>
</div>
<div class='col-md-2'>
<input type='button' class='form-control btn btn-block' value='Search'>
</div>
</div>
</div>
</form>
</div>
Text-box is not loosing its width you can check here.
CODE : http://jsfiddle.net/Jaysinh/awYm3/
As per the Bootstrap documentation of Form you have to set the width of the element. Default is 100 % wide.
Requires custom widths
Inputs, selects, and textareas are 100% wide by default in Bootstrap. To use the inline form, you'll have to set a width on the form controls used within.
Here, check this out.
Demo
HTML
<div class="col-lg-6">
<form class="form-horizontal" role="form">
<div class="form-group">
<input type="text" id="test" name="city" class="form-control input-lg" placeholder="E.g. Manchester" />
</div>
<div class="form-inline">
<div class="form-group ">
<input type="text" id="city" name="city" class="form-control input-lg" placeholder="E.g. Manchester" />
<input type="button" value="Search" class=" btn btn-lg btn-default" />
</div>
<div class="form-group "></div>
</div>
</form>
</div>
I am trying to make a pretty form that will work boostrap-responsive.css for mobile use. Before I used tables, and it worked fine without bootstrap-responsive, but now it becomes very ugly when scaled down.
What I'm trying to accomplish:
Get headline/label for each input to be in top(horizontal).
Aligned right side(so it will look pretty on a phone).
Have glyphicons prepended - this is what it makes difficult, since with them I can't format it correctly
If I am too unclear of what I want to accomplish, you can also take a look at my super hightech picture that describes the form:
http://i.imgur.com/xcvL0hp.jpg
My code half working code is:
<form class="form-vertical" ....>
<fieldset>
<div class="row-fluid">
<div class="span8 input-prepend">
<label class="control-label" for="title">Title</label>
<span class="add-on"><i id="titleicon" class="icon-minus-sign"></i></span>
<input type="text" name="title" id="title" />
</div>
<div></div>
<div class="span2 input-prepend">
<label class="control-label" for="price">Price</label>
<span class="add-on"><i id="priceicon" class="icon-minus-sign"></i></span>
<input type="text" id="price" name="price"/>
</div>
</div>
<div class="controls">
<label class="control-label" for="description">Description</label>
<div class="input-prepend">
<span class="add-on"><i id="descriptionicon" class="icon-minus-sign"></i>/span>
<textarea name="description" rows="6" class="field span6" id="descriptionfield"></textarea>
</div>
</div>¨
</fieldset>
</form>
I am not sure I formatted it correctly for stackoverflow(this is my first question) so it is here too with syntax highlighting: http://pastebin.com/LzN1vbYi
I know there are tons of answers to very similar question, but that prepended glyph makes none of the code work. I tried around 15 different approaches.
you should try this form
<div class="row-fluid>
<div class="span12>
<form class="form-horizontal">
<div class="control-group">
<label class="control-label" for="title">Title</label>
<div class="controls">
<span class="add-on"><i id="titleicon" class="icon-minus-sign"></i></span>
<input type="text" name="title" id="title" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="price">Price</label>
<div class="controls">
<span class="add-on"><i id="priceicon" class="icon-minus-sign"></i></span>
<input type="text" id="price" name="price"/>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox"> Remember me
</label>
<button type="submit" class="btn">Sign in</button>
</div>
</div>`
</form>
</div>
</div>