I'm a beginner at Bootstrap. When I press Tab, I want to select the next tab.
Click loan_form.php and then the cursor is automatically in Loan Name. After you complete it and press tab on the keyboard, the cursor will move to the Department label instead of the Device code label:
<div class="row">
<div class="col-md-6 mb-3">
<label>* Loan Name</label>
<input type="text" class="form-control" name="loan_name" id="loan_name" placeholder="Full Name" required>
</div>
<div class="col-md-6 mb-3">
<label>Device Code</label>
<select name="device_code" class="form-control" id="device_code" data-validetta="required" ></select>
</div>
</div>
<br />
<div class="row">
<div class="col-md-6 mb-3">
<label>* Department</label>
<input type="text" class="form-control" name="dept" id="dept" placeholder="Department" required></div>
<div class="col-md-6 mb-3">
<label>Brand</label>
<input type="text" class="form-control" name="device_brand" id="device_brand" placeholder="Brand" disabled required>
</div>
Use tabindex html tag in all the input fields. See reformatted code here:
<div class="row">
<div class="col-md-6 mb-3">
<label>* Loan Name</label>
<input type="text" class="form-control" name="loan_name" id="loan_name" placeholder="Full Name" required tabindex="1">
</div>
<div class="col-md-6 mb-3">
<label>Device Code</label>
<select name="device_code" class="form-control" id="device_code" data-validetta="required" tabindex="2"></select>
</div>
</div>
<br />
<div class="row">
<div class="col-md-6 mb-3">
<label>* Department</label>
<input type="text" class="form-control" name="dept" id="dept" placeholder="Department" required tabindex="3"></div>
<div class="col-md-6 mb-3">
<label>Brand</label>
<input type="text" class="form-control" name="device_brand" id="device_brand" placeholder="Brand" disabled required tabindex="4">
</div>
Related
The form is based on bootstrap here is the code:
When i try to validate the submition of the for using this very simple code.
Then the form just disappears. Any insights guys would be greatly appreciated.
Thanks
New gal to coding.
<div class="container">
<div class="row">
<div class="col-sm-12 contact-form">
<form id="contact" method="post" class="form" role="form">
<div class="row">
<div class="col-xs-6 col-md-6 form-group">
<input class="form-control" id="name" name="name" placeholder="FIRST NAME" type="text" required autofocus />
</div>
<div class="col-xs-6 col-md-6 form-group">
<input class="form-control" id="name" name="lastname" placeholder="LAST NAME" type="text" required
autofocus />
</div>
<div class="col-xs-6 col-md-6 form-group">
<input class="form-control" id="email" name="email" placeholder="EMAIL" type="email" required />
</div>
<div class="col-xs-6 col-md-6 form-group">
<input class="form-control" id="name" name="phone" placeholder="PHONE" type="text" required autofocus />
</div>
<div class="col-xs-6 col-md-6 form-group">
<input class="form-control" id="name" name="address1" placeholder="ADDRESS 1" type="text" required
autofocus />
</div>
<div class="col-xs-6 col-md-6 form-group">
<input class="form-control" id="name" name="address2" placeholder="ADDRESS 2" type="text" required
autofocus />
</div>
<div class="col-xs-6 col-md-6 form-group">
<input class="form-control" id="name" name="city" placeholder="CITY" type="text" required autofocus />
</div>
<div class="col-xs-3 col-md-3 form-group">
<input class="form-control" id="name" name="state" placeholder="STATE" type="text" required autofocus />
</div>
<div class="col-xs-3 col-md-3 form-group">
<input class="form-control" id="name" name="zipcode" placeholder="ZIPCODE" type="text" required autofocus />
</div>
<h1 class="h1-contact">WHAT SERVICES ARE YOU INTERESTED IN?</h1>
</div>
<div class="row">
<div class="col-sm-6">
<h3>SELECT ALL THAT APPLY:</h3>
<label class="checkbtn">item 1
<input type="checkbox" checked="checked" name="item5" value="item5">
<span class="checkmark"></span>
</label>
<label class="checkbtn"> item 2
<input type="checkbox" name="item4" id="item4">
<span class="checkmark"></span>
</label>
<label class="checkbtn">item 3
<input type="checkbox" name="item3" id="item3">
<span class="checkmark"></span>
</label>
<label class="checkbtn">item 4
<input type="checkbox" name="item2" id="item2">
<span class="checkmark"></span>
</label>
<label class="checkbtn">item 5
<input type="checkbox" name="example1">
<span class="checkmark"></span>
For my website, when this particular page is clicked I want the form to be populated with data from the database. Here is the code for the form:
<form class="form-horizontal" role="form" method="post" action="{{url('/company-profile/update')}}">
{{ csrf_field() }}
#foreach($getAllDetails as $list)
<div class="form-group">
<div class="col-sm-10">
<label for="companyname" class="control-label">Company Name</label>
<input type="text" class="form-control" id="companyname" name="companyname" placeholder="Enter Company Name" value={{$list->companyName}}>
</div>
</div>
<div class="form-group">
<div class="col-xs-5 col-sm-4 col-md-3">
<label for="shortCode" class="control-label">Short Code</label>
<input class="form-control" id="shortCode" name="shortCode" placeholder="Short Code" value={{$list->shortCode}}>
</div>
<div class="col-xs-7 col-sm-6 col-md-7">
<label for="telnum" class="control-label">Telephone Number</label>
<input type="tel" class="form-control" id="telnum" name="telnum" placeholder="Tel. number" value={{$list->phoneNo}}>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<label for="emailid" class="control-label">Email</label>
<input type="email" class="form-control" id="emailid" name="emailid" placeholder="Email" value={{$list->emailAddress}}>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<label for="logoPath" class="control-label">Logo Path</label>
<input type="" class="form-control" id="logoPath" name="logoPath" placeholder="Enter Logo Path" value={{$list->logoPath}}>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<label for="feedback" class="control-label">Contact Address</label>
<textarea class="form-control" id="address" name="address" rows="2" value={{$list->contactAddress}}></textarea>
</div>
</div>
#endforeach
<div class="form-group">
<div class="col-sm-10">
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
This issue is:
For example, if I want to fetch the company name {{$list->companyName}} only the first word gets displayed. For example, If the company's name is National Film Institute, only National gets displayed.
Here is code the for my index function in the controller:
public function index()
{
$data['getAllDetails']= DB::table('tblcompany')->get();
return view('companyProfile.companyProfile', $data);
}
Change
value={{$list->your_field}}
to
value="{{$list->your_field}}"
I have a contact form in php which has has two tabs containing two different contact forms. I want to get all the values of both the forms and send it as an email. I have coded it for one of the tab, but i am not getting the values of each of the field in the contact form in that tab. Can anyone tell how to do this ? My code is shown below for one of the tab:
<form name="contactForm" id='contact_form' method="post" action=''>
<div tab-id="1" class="tab active">
<div class="form-inline">
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="name" id="exampleInputName" placeholder="name" >
</div>
<div class="form-group col-sm-12 padd">
<input type="email" class="form-control" name="email" id="exampleInputEmail" placeholder="email address">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="telephone" placeholder="phone">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="Country" id="exampleInputName" placeholder="Country" >
</div>
<div class="form-group col-sm-12 padd">
<textarea class="form-control" name="message" rows="3" id="exampleInputMessage" placeholder="message" ></textarea>
</div>
</div>
<div class="form-group col-xs-12 padd">
<div id='mail_success' class='success' style="display:none;">Your message has been sent successfully.
</div><!-- success message -->
<div id='mail_fail' class='error' style="display:none;"> Sorry, error occured this time sending your message.
</div><!-- error message -->
</div>
<div class="form-group col-xs-8 padd">
<div class="g-recaptcha" data-sitekey="6LcJqyITAAAAABks5hnD6U_2ptu09RiXYOHvNNud"></div>
</div>
<div class="form-group col-sm-4 padd" id='submit'>
<input type="submit" id='send_message' name="send" class="btn btn-lg costom-btn" value="send">
</div>
</div>
<div tab-id="2" class="tab">
<div class="form-inline">
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="name" id="exampleInputName" placeholder="full name" >
</div>
<div class="form-group col-sm-6 padd">
<input type="email" class="form-control" name="email" id="exampleInputEmail" placeholder="Email">
</div>
<div class="form-group col-sm-6 pad">
<input type="text" class="form-control" name="telephone" placeholder="Phone">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="subject" id="exampleInputSubject" placeholder="Tell us about your project in your own words ?" >
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="subject" id="exampleInputSubject" placeholder="Tell us about you or your company" >
</div>
<div class="form-group col-sm-12 padd">
<p>Which services are you interested in ?</p>
<p>
<input type="checkbox" id="test1" />
<label for="test1"></label>
</p>
<p>
<input type="checkbox" id="test2"/>
<label for="test2"></label>
</p>
<p>
<input type="checkbox" id="test3"/>
<label for="test3"></label>
</p>
<p>
<input type="checkbox" id="test4"/>
<label for="test4"></label>
</p>
<p>
<input type="checkbox" id="test5"/>
<label for="test5"></label>
</p>
<p>
<input type="checkbox" id="test6"/>
<label for="test6"></label>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<div id='mail_success' class='success' style="display:none;">Your message has been sent successfully.
</div><!-- success message -->
<div id='mail_fail' class='error' style="display:none;"> Sorry, error occured this time sending your message.
</div><!-- error message -->
</div>
<div class="form-group col-sm-12" id='submit'>
<input type="submit" id='send_message' class="btn btn-lg costom-btn" value="send">
</div>
</div>
</form>
Please try with this code.
<form name="contactForm" id='contact_form' method="post" action='php/email.php'>
//This is the first tab
<div tab-id="1" class="tab active">
<div class="form-inline">
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="name" id="exampleInputName" placeholder="name" >
</div>
<div class="form-group col-sm-12 padd">
<input type="email" class="form-control" name="email" id="exampleInputEmail" placeholder="email address">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="telephone" placeholder="phone">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="Country" id="exampleInputName" placeholder="Country" >
</div>
<div class="form-group col-sm-12 padd">
<textarea class="form-control" name="message" rows="3" id="exampleInputMessage" placeholder="message" ></textarea>
</div>
</div>
<div class="form-group col-xs-12 padd">
<div id='mail_success' class='success' style="display:none;">Your message has been sent successfully.
</div><!-- success message -->
<div id='mail_fail' class='error' style="display:none;"> Sorry, error occured this time sending your message.
</div><!-- error message -->
</div>
<div class="form-group col-xs-8 padd">
<div class="g-recaptcha" data-sitekey="6LcJqyITAAAAABks5hnD6U_2ptu09RiXYOHvNNud"></div>
</div>
<div class="form-group col-sm-4 padd" id='submit'>
<input type="submit" id='send_message' name="send" class="btn btn-lg costom-btn" value="send">
</div>
</div>
//This is the Second tab
<div tab-id="2" class="tab">
<div class="form-inline">
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="name" id="exampleInputName" placeholder="full name" >
</div>
<div class="form-group col-sm-6 padd">
<input type="email" class="form-control" name="email" id="exampleInputEmail" placeholder="Email">
</div>
<div class="form-group col-sm-6 pad">
<input type="text" class="form-control" name="telephone" placeholder="Phone">
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="subject" id="exampleInputSubject" placeholder="Tell us about your project in your own words ?" >
</div>
<div class="form-group col-sm-12 padd">
<input type="text" class="form-control" name="subject" id="exampleInputSubject" placeholder="Tell us about you or your company" >
</div>
<div class="form-group col-sm-12 padd">
<p>Which services are you interested in ?</p>
<form action="#">
<p>
<input type="checkbox" id="test1" />
<label for="test1">Web Design & development</label>
</p>
<p>
<input type="checkbox" id="test2"/>
<label for="test2">E-Commerce Solutions</label>
</p>
<p>
<input type="checkbox" id="test3"/>
<label for="test3">Digital Marketing</label>
</p>
<p>
<input type="checkbox" id="test4"/>
<label for="test4">SEO Solutions</label>
</p>
<p>
<input type="checkbox" id="test5"/>
<label for="test5">2D&3D Animation</label>
</p>
<p>
<input type="checkbox" id="test6"/>
<label for="test6">Game development</label>
</p>
</div>
</div>
<div class="form-group col-xs-12">
<div id='mail_success' class='success' style="display:none;">Your message has been sent successfully.
</div><!-- success message -->
<div id='mail_fail' class='error' style="display:none;"> Sorry, error occured this time sending your message.
</div><!-- error message -->
</div>
<div class="form-group col-sm-12" id='submit'>
<input type="submit" id='send_message' class="btn btn-lg costom-btn" value="send">
</div>
</form>
</div>
Assuming the following form-tab html structure:
<form name="contactForm" id='contact_form' method="post" action=''>
<div tab-id="1" class="tab active">
...
<input name="field1" value="" class="form-control" />
<input name="field2" value="" class="form-control" />
</div>
<div tab-id="2" class="tab">
...
<input name="field1" value="" class="form-control" />
<input name="field2" value="" class="form-control" />
</div>
</form>
As your div tabs have not attribute called id, and the class attribute you assigned is the same for every tab, it is not clear to see how to define the jquery selector for the inputs within those tabs you created.
You can access the values of each tab, using jquery as follows:
var fields = {}
fields.tab1 = {}
fields.tab1.field1 = $('div[tab-id=1] input[name=field1]').val()
fields.tab1.field2 = $('div[tab-id=1] input[name=field2]').val()
fields.tab2 = {}
fields.tab2.field1 = $('div[tab-id=2] input[name=field1]').val()
fields.tab2.field2 = $('div[tab-id=2] input[name=field2]').val()
Here is the fiddle of the working example.
var datastring = $("#contact_form").serialize();
alert(datastring);
try this in jquery after , you wiil get all the elements values between the
...
here data strings gives output as below
name=tj&email=tj#gmail.com&telephone=8888888888&Country=ind&message=msdfdf&name=tj&email=tj#gmail.com&telephone=12345689&subject=sub&subject=sub
I work on from to add more than one device when user click on add more
But How can I group multiple fields with same name as array for every device from this form, my server side language is PHP.
<form>
<div class="row">
<div class="col-md-12">
<div class="widget stacked">
<div class="widget-header">
<i class="icon-hdd"></i>
<h3>Remove Devices</h3> <a class="btn label label-success add_new_device">Add more</a>
</div>
<div class="widget-content">
<div class="form-group">
<label for="device_name">Device Name</label>
<input class="form-control" data-validation="length" data-validation-length="max128" data-validation-optional="true" name="device[device_name][]" type="text">
</div>
<div class="form-group">
<label for="device_description">Device Description</label>
<input class="form-control" data-validation="length" data-validation-length="max255" data-validation-optional="true" name="device[device_description][]" type="text">
</div>
<div class="form-group">
<label for="device_url">Device Url</label>
<input class="form-control" data-validation="url" data-validation-optional="true" data-validation-help="Ex: http://000.000.000.000/index.cgi" name="device[device_url][]" type="url">
</div>
<div class="form-group">
<label for="device_ip4">IP4</label>
<input class="form-control" data-validation="length" data-validation-length="max15" data-validation-optional="true" data-validation-help="Ex: 000.000.000.000" name="device[device_ip4][]" type="text">
</div>
<div class="form-group">
<label for="device_ip6">IP6</label>
<input class="form-control" data-validation="length" data-validation-length="max45" data-validation-help="Ex: 0000:0000:0000:0000:0000:0000" name="device[][device_ip6]" type="text">
</div>
<div class="form-group">
<label for="device_username">Device Username</label>
<input class="form-control" data-validation="length" data-validation-length="max128" data-validation-optional="true" name="device[][device_username]" type="text">
</div>
<div class="form-group">
<label for="device_password">Device Password</label>
<input class="form-control" data-validation="length" data-validation-length="max128" data-validation-optional="true" name="device[][device_password]" type="text">
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="widget stacked">
<div class="widget-header">
<i class="icon-hdd"></i>
<h3>Remove Devices</h3> <a class="btn label label-success add_new_device">Add more</a>
</div>
<div class="widget-content">
<div class="form-group">
<label for="device_name">Device Name</label>
<input class="form-control" data-validation="length" data-validation-length="max128" data-validation-optional="true" name="device[device_name][]" type="text">
</div>
<div class="form-group">
<label for="device_description">Device Description</label>
<input class="form-control" data-validation="length" data-validation-length="max255" data-validation-optional="true" name="device[device_description][]" type="text">
</div>
<div class="form-group">
<label for="device_url">Device Url</label>
<input class="form-control" data-validation="url" data-validation-optional="true" data-validation-help="Ex: http://000.000.000.000/index.cgi" name="device[device_url][]" type="url">
</div>
<div class="form-group">
<label for="device_ip4">IP4</label>
<input class="form-control" data-validation="length" data-validation-length="max15" data-validation-optional="true" data-validation-help="Ex: 000.000.000.000" name="device[device_ip4][]" type="text">
</div>
<div class="form-group">
<label for="device_ip6">IP6</label>
<input class="form-control" data-validation="length" data-validation-length="max45" data-validation-help="Ex: 0000:0000:0000:0000:0000:0000" name="device[][device_ip6]" type="text">
</div>
<div class="form-group">
<label for="device_username">Device Username</label>
<input class="form-control" data-validation="length" data-validation-length="max128" data-validation-optional="true" name="device[][device_username]" type="text">
</div>
<div class="form-group">
<label for="device_password">Device Password</label>
<input class="form-control" data-validation="length" data-validation-length="max128" data-validation-optional="true" name="device[][device_password]" type="text">
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="widget stacked">
<div class="widget-header">
<i class="icon-hdd"></i>
<h3>Remove Devices</h3> <a class="btn label label-success add_new_device">Add more</a>
</div>
<div class="widget-content">
<div class="form-group">
<label for="device_name">Device Name</label>
<input class="form-control" data-validation="length" data-validation-length="max128" data-validation-optional="true" name="device[device_name][]" type="text">
</div>
<div class="form-group">
<label for="device_description">Device Description</label>
<input class="form-control" data-validation="length" data-validation-length="max255" data-validation-optional="true" name="device[device_description][]" type="text">
</div>
<div class="form-group">
<label for="device_url">Device Url</label>
<input class="form-control" data-validation="url" data-validation-optional="true" data-validation-help="Ex: http://000.000.000.000/index.cgi" name="device[device_url][]" type="url">
</div>
<div class="form-group">
<label for="device_ip4">IP4</label>
<input class="form-control" data-validation="length" data-validation-length="max15" data-validation-optional="true" data-validation-help="Ex: 000.000.000.000" name="device[device_ip4][]" type="text">
</div>
<div class="form-group">
<label for="device_ip6">IP6</label>
<input class="form-control" data-validation="length" data-validation-length="max45" data-validation-help="Ex: 0000:0000:0000:0000:0000:0000" name="device[][device_ip6]" type="text">
</div>
<div class="form-group">
<label for="device_username">Device Username</label>
<input class="form-control" data-validation="length" data-validation-length="max128" data-validation-optional="true" name="device[][device_username]" type="text">
</div>
<div class="form-group">
<label for="device_password">Device Password</label>
<input class="form-control" data-validation="length" data-validation-length="max128" data-validation-optional="true" name="device[][device_password]" type="text">
</div>
</div>
</div>
</div>
</div>
</form>
Name your fields like devices[0][description], devices[1][description] and so on.
If every object has the exact same number of fields and every one is a new record - you can use devices[][description] and browser will fill indexes for you, but this can lead to bugs in the future, if you decide to use same form for editing records.
Also see How to get form input array into PHP array
I'm in the process of migrating a Drupal build out to Bootstrap framework. In the new Bootstrap framework, I've built out a form to pull results from a database.
Bootstrap form HTML:
<form class="form-horizontal" role="form" method="post" action="<?php echo lookup_dosearchx() ?>">
<br>
<div class="form-group">
<label for="county2" class="col-sm-3 control-label">County:</label>
<div class="col-sm-6">
<input type="text" name="county2" id="county2" class="form-control" placeholder="Enter County Name" required />
</div>
</div>
<hr>
<center><i>Include Payroll Notes:</i></center><br>
<div class="form-group">
<label for="employee" class="col-sm-3 control-label">Employee:</label>
<div class="col-sm-6">
<select class="form-control" name="employee" id="employee" placeholder="Enter Employee Name" /><option>Any</option></select>
</div>
</div>
<div class="form-group">
<label for="startdate" class="col-sm-3 control-label">State Date (mm/dd/yyyy):</label>
<div class="col-sm-6">
<input type="date" name="startdate" id="startdate" class="form-control" placeholder="Enter Start Date" />
</div>
</div>
<div class="form-group">
<label for="enddate" class="col-sm-3 control-label">End Date (mm/dd/yyyy):</label>
<div class="col-sm-6">
<input type="date" name="enddate" id="enddate" class="form-control" placeholder="Enter End Date" />
</div>
</div>
<div class="form-group">
<label for="fulltext" class="col-sm-3 control-label">Fulltext Query:</label>
<div class="col-sm-6">
<textarea class="form-control" name="fulltext" id="fulltext" rows="4" /></textarea>
</div>
</div>
<div class="form-group">
<label for="contain" class="col-sm-3 control-label">Phrase:</label>
<div class="col-sm-6">
<textarea class="form-control" name="contain" id="contain" rows="4" /></textarea>
</div>
</div>
<div class="form-group">
<label for="jobid" class="col-sm-3 control-label">VCS Job Code:</label>
<div class="col-sm-6">
<select class="form-control" name="jobid" id="jobid" placeholder="Enter Job Code" /><option>Any</option></select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button type="submit" class="btn btn-primary">Submit</button>
<button type="reset" class="btn btn-default">Clear</button>
</div>
</div>
</div>
<br>
</form>
I was provided with a large PHP query set from the prior build out, but that code isn't working when I hit submit. The database is connecting fine as I had trouble getting that to work before.
Would it be possible to be pointed in the direction of a simple example or recommended way to build out the PHP query code I'm calling out?