Reputation:
I want to ensure the first letter of each word is capitalized in a form submission.
@csrf
<div class="form-group">
<label for="group_title">Group Title:</label>
<input type="text" class="form-control" name="group_title" />
</div>
<div class="form-group">
<label for="group_description">Group Description:</label>
<textarea class="form-control" rows="5" name="group_description"></textarea>
</div>
<!-- Date picker -->
<div class="form-group">
<label for="group_date">Group Date:</label>
<input type="text" id="datepicker" class="form-control" name="group_date" autocomplete="off" />
</div>
<!-- Time -->
<div class="form-group">
<label for="group_time">Group Time:</label>
<input type="time" class="form-control" name="group_time" />
</div>
<button type="submit" class="btn btn-success">Add Group</button>
</form>
This is actually a Laravel specific question which has now been answered below.
Upvotes: 0
Views: 3702
Reputation: 1017
You can use the function ucfirst
from PHP
For example
{{ ucfirst(trans('messages.yourMessage')) }}
Upvotes: 2
Reputation: 76
In Css: If we use capitalize a word that's in all capital letters already, the other letters in the word won't switch to lowercase.
In php: The ucwords() function converts the first character of each word in a string to uppercase.
echo ucwords("hello world"); //converts the first character of a string to uppercase
Upvotes: 1