ServiceNow Table Variable Widget Amendment - html

I have found a widget on ServiceNow share that allows you to add a table set of variables and then dynamically get the user to add multiple rows. We would like to use this, however our requirements are to have around 25 variables as columns in the table.
On this widget once you get past 10 columns, it starts to truncate the width of the columns, and this continues until they are too small to be useable. Once you get past 20 columns it starts to add further columns outside of the window. I was wondering how we could amend this widget to stop the columns width truncating and then once you reach the limit of the container for a horizontal scroll bar to appear. Below is the HTML of the Widget:
<fieldset class="form-group form-group-has-focus" ng-class="{'edit_mode':edit_mode}">
<label ng-if="data.title != ''" class="field-label" style="display:block;">
<span class="field-decorations">
<span ng-show="data.is_mandatory" style="padding-right: .25em" title="${Mandatory}" class="fa fa-asterisk mandatory" ng-class="{'mandatory-filled': mandatory_filled()}" aria-hidden="false"></span>
</span>
{{data.title}}
<a ng-if="data.can_edit" ng-hide="edit_mode" class="pull-right" href="javascript:void(0)" ng-click="goToEditMode()">
<i title="Edit Table" class="fa fa-pencil-square-o"></i>
</a>
</label>
<div ng-if="edit_mode">
<div class="alert alert-warning" ng-if="!data.columns_specified">
No table definition provided, define your table information and then click Setup Data Table to start building the table definition record
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="columnLength">Table Label</label>
<div class="col-sm-10">
<input class="form-control" ng-model="data.title" type="text" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="columnLength">Number of Rows to Display</label>
<div class="col-sm-10">
<input class="form-control" ng-model="data.table_options.row_count" type="number" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="columnLength">Max Number of Rows (set to -1 for infinite)</label>
<div class="col-sm-10">
<input class="form-control" ng-model="data.table_options.max_rows" type="number" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="columnLength">Allow new Rows</label>
<div class="col-sm-10">
<input ng-model="data.table_options.allow_row_add" type="checkbox" />
</div>
</div>
<button ng-if="temp_columns.length > 0" ng-disabled="data.title==''" ng-click="setupTable()" class="btn btn-primary">Setup Data Table</button>
</div>
<div ng-if="!edit_mode && data.columns_specified">
<table wt-responsive-table>
<tbody>
<tr>
<th ng-repeat="tableHeader in data.table_options.fields|filter:{'visible':true}">
{{tableHeader.label}}
<span class="field-decorations">
<span ng-show="tableHeader.mandatory" style="padding-left: .25em" title="${Mandatory}" class="fa fa-asterisk mandatory" aria-hidden="false"></span>
</span>
</th>
</tr>
<tr ng-repeat="(rowID,rowCounter) in table_data" id="tableRow_{{rowCounter.number}}">
<td ng-repeat="(columnID,field) in rowCounter.fields" ng-if="isVisibleColumn(columnID)" class="column-data">
<div class="form-group" ng-class="{'has-success' : field.value != ''}">
<jb-tablevar-column field="field" data="data" c="c" table_data="table_data" rowid="rowID" columnid="columnID" run-on-change="runOnChange" parse-reference-qual="parseReferenceQual"></jb-tablevar-column>
</div>
</td>
<td ng-if="$index > 0">
<a class="remove-row-link" href="javascript:void(0);" ng-click="deleteRow(rowID)">
<i title="{{data.table_options.remove_row_title}}" class="fa fa-minus-circle fa-2x remove-row"></i>
</a>
<button class="remove-row-btn btn btn-danger" ng-click="deleteRow(rowID)">
{{data.table_options.remove_row_title}}
</button>
</td>
</tr>
<tbody>
</table>
<div ng-if="((data.table_options.row_count < data.table_options.max_rows) || data.table_options.max_rows == -1) && data.table_options.allow_row_add">
<button ng-click="addRow()" class="btn btn-primary">{{data.table_options.add_row_title}}</button>
</div>
</div>
</fieldset>
This is the CSS:
fieldset.edit_mode {
border-left:10px solid #dedede;
padding-left:10px;
}
.has-success .form-control-success {
background-image: url("JB_GreenTick.pngx");
}
.form-control-danger, .form-control-success, .form-control-warning {
padding-right: 2.25rem;
background-repeat: no-repeat;
background-position: center right .625rem;
-webkit-background-size: 1.25rem 1.25rem;
background-size: 1.25rem 1.25rem;
}
i.remove-row {
padding: 0px 5px 20px;
color: #a0303c;
cursor: pointer;
}
button.remove-row-btn {
display:none;
}
.responsive td .form-group {
padding-left:5px;
padding-right:5px;
}
#media only screen and (max-width: 600px) {
.responsive tr{margin-top: 5px;}
a.remove-row-link {display:none;}
button.remove-row-btn {display:block;}
}

Related

Bootstrap width is overflowing and not fitting to form content

I have several forms on a webpage (utilizing Bootstrap 4) and all of them have some content overflow. I can't figure out how to fix it and make the width to fit the form content. Here is a screenshot of one of the simpler forms. This is another screenshot of the other forms in case it helps. Below is some of my code.
page.html
<div class="admin_section">
<h3>Removals</h3>
<div class="admin_section_content container">
<form method="post">
<div class="form-group row">
<label for="deleteName" class="col-sm-2 col-form-label">Remove a Menu Item</label>
<div class="col-sm-2">
<input type="text" name="remove_item_name" pattern="^[a-zA-ZÀ-ÿ-' ]+$" maxlength="25"
class="form-control" id="deleteName" placeholder="Food Item Name" required>
</div>
</div>
<div class="form-group row">
<label for="removeItem" class="col-sm-2 col-form-label"></label>
<div class="col-sm-2 text-right">
<button type="submit" class="btn btn-danger" id="removeItem" name="remove_item_button"
value="clicked">Remove Item</button>
</div>
</div>
</form>
<br><br>
<form method="post">
<div class="form-group row">
<label for="deleteReceipt" class="col-sm-2 col-form-label">Refund a Receipt</label>
<div class="col-sm-2">
<input type="text" name="remove_receipt_number" pattern="^\d{10}$" minlength="10" maxlength="10"
class="form-control" id="deleteReceipt" placeholder="Receipt Number" required>
</div>
</div>
<div class="form-group row">
<label for="removeReceipt" class="col-sm-2 col-form-label"></label>
<div class="col-sm-2 text-right">
<button type="submit" class="btn btn-danger" id="removeReceipt" name="remove_receipt_button"
value="clicked">Refund Receipt</button>
</div>
</div>
</form>
</div>
</div>
general.css
.admin_section{
margin-bottom: 1.5rem;
margin-left: 35%;
margin-right: auto;
}
.admin_section_content{
font-family: 'Segoe UI', 'Open Sans', 'Helvetica Neue', sans-serif;
margin-left: 2rem;
}
select{
border-color: var(--bootstrap-grey);
border-radius: 5px;
}
form{
background-color: var(--form-grey);
border-radius: 5px;
padding: 15px;
}
body{
overflow-x: hidden;
}
Thanks for the extra information Yariel. See what happens if you put the form inside a column.
<div class="col-sm-12 col-md-6">
<form method="post">
<div class="form-group row">
<label for="deleteName" class="col-sm-2 col-form-label">Remove a Menu Item</label>
<div class="col-sm-2">
<input type="text" name="remove_item_name" pattern="^[a-zA-ZÀ-ÿ-' ]+$" maxlength="25"
class="form-control" id="deleteName" placeholder="Food Item Name" required>
</div>
</div>
<div class="form-group row">
<label for="removeItem" class="col-sm-2 col-form-label"></label>
<div class="col-sm-2 text-right">
<button type="submit" class="btn btn-danger" id="removeItem" name="remove_item_button"
value="clicked">Remove Item</button>
</div>
</div>
</form>
</div>
```

bootstrap modal form label/textbox size empty spaces issue

At the start, the first label line has empty spaces in front of it, causing it to be pushed forward. Hence, I adjusted it using style in the HTML page, why and how do I resolve this issue?
I am unable to change the textbox size of the form as well. I would like to change the textbox size in the Food div container, both of the text boxes to be aligned in one straight line and the word "To" in between the boxes, without affecting the whole form alignment.
#output_image{
border-style: solid;
float:left;
}
.inputfile {
width: 0.1px;
height: 0.1px;
opacity: 0;
overflow: hidden;
position: relative;
z-index: -1;
}
.label{
opacity: 0;
}
.inputfile + label {
position: relative;
font-size: 2.5em;
display: inline-block;
color: black;
text-align: center;
padding: 2px 2px;
text-decoration: none;
float:left;
}
.inputfile:focus + label,
.inputfile + label:hover {
}
.inputfile + label {
cursor: pointer;
}
.iconplus{
position: relative;
}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-lg">
Instagram Like
</button>
<!-- Modal -->
<div class="modal fade bd-example-modal-lg" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-right" role="document">
<div class="modal-content">
<div class="modal-header ">
<h2 style="font-family: Lato; font-size:29pt; font-weight:bold;" class="modal-title " id="exampleModalLongTitle">Instagram</h2>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body form-horizontal">
<form class="form-horizontal" id="step2">
<img id="output_image" height=270px width=270px>
<input class="inputfile" type="file" id="getFile" accept="image/*" onchange="preview_image(event)">
<label for="getFile" <i class="fa fa-plus-circle iconplus" style = "position:relative; top:23.1rem; right:3.45rem;"></i> </label>
<div class="form-group row align-items-center justify-content-center">
<label style="font-family:Lato; font-size:20pt; font-weight:normal; margin-right:6.8rem;" for="name" class="col-sm-4 control-label col text-left">Name:</label>
<div class="col-sm-5 ">
<input id="name" style= "margin-right:10rem;" class="form-control input-lg row align-items-left justify-content-left" type="text" placeholder="Enter Name" />
</div>
</div>
<div class="form-group row align-items-center justify-content-center">
<label style="font-family:Lato; font-size:20pt; font-weight:normal;" for="name" class="col-sm-4 control-label col text-left">Email:</label>
<div class="col-sm-5 ">
<input id="name" class="form-control input-lg row align-items-left justify-content-left" type="text" placeholder="Enter Your Email Address" />
</div>
</div>
<div class="form-group row align-items-center justify-content-center">
<label style="font-family:Lato; font-size:20pt; font-weight:normal;" for="name" class="col-sm-2 control-label col text-left " >Food Date:</label>
<div class="col-sm-3">
<input id="name" class="form-control input-lg row align-items-center justify-content-left" type="password" placeholder="Start Food" />
</div>
<label style="font-family:Lato; font-size:20pt; font-weight:normal;" for="name" class="col-sm-2 control-label col text-left " >To</label>
<div class="col-sm-3">
<input id="name" class="form-control input-lg row align-items-center justify-content-left" type="password" placeholder="End Food" />
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Create</button>
</div>
</div>
</div>
</div>
</div>

Trying to position my date range picker across one row

When I select the date range option from my dropdown button, the date range options appear on top of each other (see image below). I would like for them to appear in the same row. One option I tried was playing with width, in both pixels and percentages, and when I added it, the entire card stretched to to the right. Does anybody know why this is happening?
This is how it normally looks prior to selecting "Date Range" from the dropdown menu.
When I select "Date Range", this is how it appears. Would like for it to be on one row, instead on top of each other.
When I play with the width property in CSS, the card stretches to the right, which is what I don't want.
<div class="report-card-i report-card-i-height" style="position: fixed; z-index: 10; background-color: #fff; float: unset; top: 80px; padding-left: 100px; padding-right: 85px;">
<h1>ABC Corp - Summary</h1>
<div class="col-lg-3 text-center">
#{
<select onchange="updateDates(this, null, null, null )">
<option value="0" selected></option>
#for (int i = 1; i < #Model.droplist i++)
{
var tempValue = i;
<option value="#tempValue">#Model.droplist.ElementAt(i)</option>
}
</select>
}
</div>
<div class="col-lg-8" id="dateRange" style="display: none; width:1px">
<div class="col-lg-2">
<div class="input-group date" id="divFrom">
<div class="form-line">
<input id="startDate" name="startDate" type="text" class="form-control" style="background-color: inherit; width: 85px" placeholder="dd/mm/yyyy" value="#Model.StartDate">
</div>
<span class="input-group-addon">
<i class="fa fa-orange fa-calendar"></i>
</span>
</div>
</div>
<div class="col-lg-2">
<span class="font-13 text-muted div-center">to</span>
</div>
<div class="col-lg-2">
<div class="input-group date" id="divTo">
<div class="form-line">
<input id="endDate" name="endDate" type="text" class="form-control" style="background-color: inherit; width: 85px" placeholder="dd/mm/yyyy" value="#Model.EndDate">
</div>
<span class="input-group-addon">
<i class="fa fa-orange fa-calendar"></i>
</span>
</div>
</div>
<div class="col-lg-2">
<button id="btnTest" class="btn-orange fa-orange btn-sm" onclick="updateDateRanges()" style="margin-left: 10px">Submit</button>
</div>
</div>
<br />
<br />
<div class="fa-orange m-t-10 m-b-15 m-l-80">
<div class="row col-lg-12">
<div class="col-sm-2 col-xs-2 text-left">
</div>
<div class="col-sm-2 col-xs-2 text-left">
<h4>Number of Deliveries</h4>
</div>
<div class="col-sm-2 col-xs-2 text-left">
<h4>Deliveries per day</h4>
</div>
<div class="col-sm-2 col-xs-2 text-left">
<h4>Gross Amount Due</h4>
</div>
<div class="col-sm-1 col-xs-1 text-left">
</div>
<div class="col-sm-1 col-xs-1 text-left">
<h4>Monthly Total</h4>
</div>
<div class="col-sm-1 col-xs-1 text-left">
</div>
<div class="col-sm-1 col-xs-1 text-left">
<h4>YTD Total</h4>
</div>
</div>
</div>
</div>
There was a structural issue. Try this
<div class="row">
<div class="col-lg-4 text-center">
#{
<select onchange="updateDates(this, null, null, null )">
<option value="0" selected></option>
#for (int i = 1; i < #Model.droplist i++) { var tempValue=i; <option value="#tempValue">
#Model.droplist.ElementAt(i)</option>
}
</select>
}
</div>
<div class="col-lg-8" id="dateRange">
<div class="row">
<div class="col-lg-3">
<div class="input-group date" id="divFrom">
<div class="form-line">
<input id="startDate" name="startDate" type="text" class="form-control"
style="background-color: inherit; width: 85px" placeholder="dd/mm/yyyy"
value="#Model.StartDate">
</div>
<span class="input-group-addon">
<i class="fa fa-orange fa-calendar"></i>
</span>
</div>
</div>
<div class="col-lg-3">
<span class="font-13 text-muted div-center">to</span>
</div>
<div class="col-lg-3">
<div class="input-group date" id="divTo">
<div class="form-line">
<input id="endDate" name="endDate" type="text" class="form-control"
style="background-color: inherit; width: 85px" placeholder="dd/mm/yyyy"
value="#Model.EndDate">
</div>
<span class="input-group-addon">
<i class="fa fa-orange fa-calendar"></i>
</span>
</div>
</div>
<div class="col-lg-3">
<button id="btnTest" class="btn-orange fa-orange btn-sm" onclick="updateDateRanges()"
style="margin-left: 10px">Submit</button>
</div>
</div>
</div>
</div>

Border appears on hover

I have a list group in a card. When you hover over the topmost list group item, a border appears under it (no border when not hovering). When I set :hover override in Google Chrome's Dev Tools, the border doesn't appear. Why does this happen?
https://jsfiddle.net/williamqin123/0fkwsemn/
<div class="container">
<div class="shadow-sm card my-5">
<div class="list-group list-group-flush">
<div class="text-center list-group-item">
<h1 class="text-left d-inline-block mb-0">
Submit
<small class="text-muted">Create your ad in less than 1 minute</small>
</h1>
</div>
<form action="/submit" method="POST" class="mb-0">
<div class="form-group list-group-item">
<label for="site">Site</label>
<div class="input-group" id="site-menu">
<select class="form-control text-center" name="site" id="site" required>
</select>
<div class="btn-group-toggle input-group-append" data-toggle="buttons">
<label class="btn btn-outline-primary">
<input type="checkbox" name="meta" value='checked'> Meta
</label>
</div>
</div>
</div>
<div class="form-group list-group-item">
<label for="post-id">Post ID</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">#</span>
</div>
<input class="form-control text-center" type="number" min="1" step="1" name="id" id="post-id" required>
</div>
</div>
<div class="form-group text-center list-group-item">
<input class="btn btn-primary btn-lg" type="submit" value="Proceed">
</div>
</form>
</div>
</div>
</div>
There is a border on the element:
.list-group-item {
position: relative;
margin-bottom: -1px;
border: 1px solid rgba(0,0,0,.125);
}
You can't see it initially because the negative margin makes the next element shift upwards (by 1px) and overlap it.
This code...
.list-group-item:hover {
z-index: 1;
}
...adds a new stacking context, making it appear in front, and allows you to see the border.

Bootstrap forms aligning. "form-group row" misplaced

I'm having this problem, next "form-group row" misplaced. Working on django/jinja template (flask project).
This code:
<div class="row">
<div style="color: chocolate; padding: 10px; margin-left: 10px; font-size: 25px;">Client Details</div>
<div class="col-md-12" style="padding: 20px 0px 0px;">
<form class="form-horizontal">
<div class="col-md-6" style="border-left: 5px solid #eee; margin: 0 0 20px;">
<div class="form-group row">
<label id="labelbox" class="col-sm-2 col-form-label">Client ID</label>
<div class="input-group col-sm-6">
<input class="form-control" col-sm-6 type="text" value="" id="client-id" readonly>
<span class="input-group-btn">
<button class="btn" type="button" data-clipboard-target="client-id">Copy</button>
</span
</div>
</div>
<div class="form-group row">
<label id="labelbox" class="col-sm-2 col-form-label">Client Secret</label>
<div class="input-group col-sm-10">
<input class="form-control" type="text" value="" id="client-secret" readonly>
<span class="input-group-btn">
<button class="btn" type="button" data-clipboard-target="client-secret">Copy</button>
</span
</div>
</div>
</div>
</form>
</div>
This behavior is here: http://www.bootply.com/Ig0ilwpSdh
Ideally I would like to have newline, which I could do with , but since I'm using bootstrap, I'm thinking everything could be done with just bootstrap.
And also vertically align input fields.
By the way, misplacing appears, when I add:
<span class="input-group-btn">
Can you advice how I should better handle that?