Space between label and form element [closed] - ruby

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am new to bootstrap and HTML and want to know how can I give same spacing between form label and the text field, throughout the form. I have attached code snippet as well as an output form.
[code for the form][1][ Form output][2]

You are doing good. You need to just group your elements. Here I am going to write HTML code.
<div class="col-lg-12 form-group">
<div class="col-lg-3 text-right">
<label class="">small</label>
</div>
<div class="col-lg-5">
<input type="text" class="form-control">
</div>
</div>
<div class="col-lg-12 form-group">
<div class="col-lg-3 text-right">
<label class="">long lebel text</label>
</div>
<div class="col-lg-5">
<input type="text" class="form-control">
</div>
</div>
You need to set your label box and text box separate and push the label to the extreme right. You can check here. Hope it will help you. :)

you can use a specific column indent for your label:
<div class="form-group form-inline">
<label class="col-md-2" for="exampleInputEmail1">Email address:</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
</div>
<div class="form-group form-inline">
<label class="col-md-2" for="idForTextfield">A very long text for this label:</label>
<input type="text" class="form-control" id="idForTextfield" placeholder="your text">
</div>
also you can add some column indent for your text field so that it bounden with your limited space just add col-md-2 in the class for <input> tag.
Sample here Code sample.
Happy coding :)

Related

How to get checked radio button with database value in edit blade in laravel 8

I have value for time column in database. In edit blade i need to show the value with checked radio button.
The code I have:
<div class="col-sm-12 col-md-6">
<div class="form-group">
<label for="slot" class="mb-2">Slot</label>
<div class="form-check">
<input class="form-check-input form-check-success" type="radio" name="time" id="time"
value={{$appointment->time}}" required>
<label class="form-check-label" for="time">{{$appointment->time}}</label>
</div>
</div>
</div>
according to this I am getting only the value with a blank radio button not checked radio button.

Thymeleaf table

I have problem table when i want set value with for each i.index get error java.lang.NumberFormatException: For input string: "${i.index}". In Array i need numer so ${i.index} is int. I dont know what i do wrong.
<div class="form-group row" th:each="attribute, i: ${attributeList}">
<label class="col-sm-3 col-form-label" th:text="${attribute.name}"></label>
<div class="col-sm-9">
<input type="text" th:field="*{technicalAttributes[${i.index}].name}" class="form-
control" placeholder="Nazwa">
</div>
</div>
You can't nest expressions (*{...${...}...}) like you're doing without using preprocessing. Your code should look like this:
<div class="form-group row" th:each="attribute, i: ${attributeList}">
<label class="col-sm-3 col-form-label" th:text="${attribute.name}"></label>
<div class="col-sm-9">
<input type="text" th:field="*{technicalAttributes[__${i.index}__].name}" class="form-control" placeholder="Nazwa">
</div>
</div>
(If you weren't using the th:field attribute, the expression *{technicalAttributes[i.index].name} would also be appropriate. But since you are using a th:field you have to use preprocessing.)

Laravel form not working after clicking on the submit button [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have created a form but it does not work after clicking the submit button. What problem do I have?
<div class="col-sm-12 col-lg-6 mb-4">
<div class="card border-primary">
<div class="card-header border-primary bg-primary">Create E-Pin</div>
<div class="card-body">
<from class="form-group" method="post" action="{{ route('frontend.epin.store') }}">
#csrf
<div class="form-group">
<label >E-pin Amount</label>
<input type="text" name='amount' class="form-control">
</div>
<button type="submit" class="btn btn-primary">Create</button>
</from>
</div>
</div>
</div>
Of course it not work because you made a typo
<form class="form-group" method="post" action="{{ route('frontend.epin.store') }}">
#csrf
<div class="form-group">
<label >E-pin Amount</label>
<input type="text" name='amount' class="form-control">
</div>
<button type="submit" class="btn btn-primary">Create</button>
</form>
It should be form not from.

view new div based on option value of select tag using laravel

i have a dropdown list when i select any one option from list i should display an another form with name of the teacher and subject of the teacher in textbox.The form is not displaying.when i select one item it should display the selected name and description box to add subjects of teachers that they interested please help me
view page
<div class="portlet light bordered row">
<h1>Add teacher subject</h1>
<div class="row">
<form action = "{{ url('subjectby/adding/process') }}" method = "POST">
{{ csrf_field() }}
<div class= "col-md-12">
<div class="form-group">
<h3>Choose Teachers </h3>
<div class="input-group">
<div class="ui-widget border-dropdown" style="margin-left:50px;">
<select id="teacher" name="teachers" placeholder="Select Teacher">
<option value="">Select Teacher</option>
#foreach($user as $tec)
<option value="{{$tec->id}}">{{$tec->name}}</option>
#endforeach
</select>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="new">
<div class="form-group">
<div class="col-sm-6">
<label for="inputFacebook">Teacher Name</label>
<input type=hidden value="{{$tec->id}}" name="id">
<input type="text" value="{{$tec->name}}" class="form-control" name="name">
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<label for="inputDescription">Subject Interested</label>
<textarea class="form-control" rows="8" name="intr" placeholder="Enter Subject Interest"> </textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<input type="submit" value="add" name=b1>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
This isn't a Laravel specific problem. You are taking about DOM manipulation and so you best bet is to use jQuery or Vuejs or even vanilla Javascript if you so choose. Basically, you will write a script to watch for when your <select> changes, and then based on it's new value, show the part of the form you want.
Keep in mind that Laravel is a backend framework and so the user will never interact with it on a page. After a page loads, Laravel has done all it can do until another request is made. This is why Javascript was born - to let the user change things without reloading the page.

Laravel Edit Post Content using CKeditor

I am trying to edit existing post using CKeditor. Content isn't loading.
<div class="form-group">
<label>Content</label>
<textarea id="editor1" name="content" class="form-control" rows="3" placeholder="Enter ...">
{{ Request::old('content') }}
</textarea>
</div>
Also im having trouble getting date from the database too.
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="date" name="published_at" class="form-control" value="{{ $post->published_at->format('M jS Y') }}">
</div>
For the textarea, check for old input, but fall back to defaulting to using the model's content attribute (the post's content)
<textarea ....>{!! Request::old('content', $post->content) !!}</textarea>
For your date issue, I don't know what problem you are having.

Resources