How to get values of dynamically generated input fields vue.js - vuejs3

I have input fields that are generated dynamically when user clicks the Add button.
How can I get all the values from the inputs
Image
[1]: https://i.stack.imgur.com/keCxy.png
Here is my Code
<tr data-id="1">
<td style="width: 80px">1.</td>
<td>
<input v-model="firstNameKin" type="text " class="form-control " placeholder="Enter First name" spellcheck="false" data-ms-editor="true">
</td>
<td class="">
<input type="text " class="form-control " placeholder="Enter middle name" spellcheck="false" data-ms-editor="true">
</td>
<td class="">
<input type="text " class="form-control " placeholder="Enter middle name" spellcheck="false" data-ms-editor="true">
</td>
<td>
<select class="form-control selectpicker" data-live-search="true" title="Select Relationship">
<option value="">Father</option>
<option value="">Mother</option>
<option value="">Sister</option>
</select>
</td>
<td></td>
</tr>
<tr class="cloneCharges d-none">
<td style="width: 80px " class="categoryIndex ">#</td>
<td>
<input v-model="firstNameKin" type="text " class="form-control " placeholder="Enter First name" spellcheck="false" data-ms-editor="true">
</td>
<td class="">
<input type="text " class="form-control " placeholder="Enter middle name" spellcheck="false" data-ms-editor="true">
</td>
<td class="">
<input type="text " class="form-control " placeholder="Enter middle name" spellcheck="false" data-ms-editor="true">
</td>
<td>
<select class="form-control selectpicker" data-live-search="true" title="Select Relationship">
<option value="">Father</option>
<option value="">Mother</option>
<option value="">Sister</option>
</select>
</td>
<td class="text-right cell-change d-flex align-items-center justify-content-end">
<a class="btn btn-light btn-rounded waves-effect btn-circle btn-transparent cancel-new-category-2 " title="Cancel "><i class="bx bx-x "></i></a>
</td>
</tr>
Here is the script code that am trying to fetch the values from
data(){
return{
firstNameKin:[]
}
}

Related

Background move to left when I open a modal-lg

When I open modal-lg, the background screen moves to the left. I tried many ways, but it failed. Please see the code and change accordingly I am using Bootstrap 4. Thank you.
When I open modal-lg, the background screen moves to the left. I tried many ways, but it failed. Please see the code and change accordingly I am using Bootstrap 4. Thank you.
<!-- The Modal -->
<div class="modal fade mt-5 " id="myModal2#(count)">
<div class="modal-dialog modal-lg " style=" padding-left: 0 !important;">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h6 class="modal-title Bold">ویرایش قرارداد</h6>
</div>
<!-- Modal body -->
<div class="modal-body">
<form asp-controller="AmorMalie" asp-action="EditSubmitGhrardad" method="post">
<table class="table table-bordered text-sm ">
<thead class="text-center">
<tr style="background-color:#416992; color: white">
<th>نام پروژه</th>
<th>نوع خدمات</th>
<th>مبلغ قرارداد (ریال)</th>
<th style="width:80px">ت ج ماه</th>
<th style="width:130px">ارزش افزوده</th>
</tr>
</thead>
<tr>
<td>
<input type="hidden" class="hf_selected_val" value="#item.projectID" />
<select class="form-control " name="projectID" required autocomplete="off">
<option value="" default="" selected="">انتخاب کنید</option>
#foreach (var items in ViewBag.pros) {
<option value="#items.projectID">#items.projectName</option>
}
</select>
</td>
<input class="d-none" name="id" value="#item.id" />
<td>
<input type="hidden" class="hf_selected_val" value="#item.NoeaKhadmat" />
<select class="form-control" name="NoeaKhadmat" required autocomplete="off">
<option value="" default="" selected="">انتخاب کنید</option>
<option value="1">حسابرسی</option>
<option value="2">مالیاتی</option>
<option value="3">منابع انسانی</option>
</select>
</td>
<td><input class="form-control num" name="MablghGhrardad" onkeyup="javascript:this.value=itpro(this.value);" value="#item.MablghGhrardad" autocomplete="off" /></td>
<td><input class="form-control num" name="TadadJelse" autocomplete="off" value="#item.TadadJalaseDrMoaheGhrardad" /></td>
<td class="text-center">
<input type="checkbox" name="MashmolArzeshAfzoode" #(item.MashmolArzeshAfzoode ? "checked" : "") style="width: 1.25rem; height: 1.25rem; top: .8rem; " class="flat-red" value="True">
</td>
</tr>
<thead class="text-center mr-3">
<tr style="background-color:#416992; color: white">
<th>تاریخ شروع</th>
<th>تاریخ پایان</th>
<th style="background-color:darkgreen">تعین کارشناس</th>
<th colspan="2" class="text-center">عملیات</th>
</tr>
</thead>
<tr>
<td>
<div class="input-group" style="padding-left:9px; padding-right:9px;">
<div class="input-group-addon" style="border:1px solid gray; padding:6px">
<span> <i class="right fa fa-calendar"></i></span>
</div>
<input name="bgainDate2" id="bgainDate2#(count)" type="text" autocomplete="off" value=" #ConvertDateTime.ConvertMiladiToShamsi(item.ShoroeeProjectDate, " yyyy/MM/dd ")" class="form-control" />
</div>
</td>
<td>
<div class="input-group" style="padding-left:9px; padding-right:9px;">
<div class="input-group-addon" style="border:1px solid gray; padding:6px">
<span> <i class="right fa fa-calendar"></i></span>
</div>
<input name="EndDate2" id="EndDate2#(count)" type="text" autocomplete="off" value=" #ConvertDateTime.ConvertMiladiToShamsi(item.PayanProjectDate, " yyyy/MM/dd ")" class="form-control" />
</div>
</td>
<td>
<input type="hidden" class="hf_selected_val" value="#item.UserID" />
<select class="form-control" name="TaeenKarShnas" autocomplete="off">
<option value="" default="" selected="">انتخاب کنید</option>
#foreach (var items in ViewBag.userss) {
<option value="#items.Id">#items.FirstName #items.Family</option>
}
</select>
</td>
<td colspan="2" class="text-center">
<button type="submit" class="btn btn-success" style="color:white">ویرایش قرارداد</button>
</td>
</tr>
</table>
</form>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">بستن</button>
</div>
</div>
</div>
</div>
#{count++;}
This is what I tried and it works perfectly. You do an external CSS or internal CSS. Your choice. If you want internal. Just do a <style> insert the CSS here </style
CSS:
body:not(.modal-open){
padding-right: 0px !important;
}
Internal CSS:
<style>
body:not(.modal-open){
padding-right: 0px !important;
}
</style>
Full code:
<!-- The Modal -->
<div class="modal fade mt-5 " id="myModal2#(count)">
<div class="modal-dialog modal-lg " style=" padding-left: 0 !important;">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h6 class="modal-title Bold">ویرایش قرارداد</h6>
</div>
<!-- Modal body -->
<div class="modal-body">
<form asp-controller="AmorMalie" asp-action="EditSubmitGhrardad" method="post">
<table class="table table-bordered text-sm ">
<thead class="text-center">
<tr style="background-color:#416992; color: white">
<th>نام پروژه</th>
<th>نوع خدمات</th>
<th>مبلغ قرارداد (ریال)</th>
<th style="width:80px">ت ج ماه</th>
<th style="width:130px">ارزش افزوده</th>
</tr>
</thead>
<tr>
<td>
<input type="hidden" class="hf_selected_val" value="#item.projectID" />
<select class="form-control " name="projectID" required autocomplete="off">
<option value="" default="" selected="">انتخاب کنید</option>
#foreach (var items in ViewBag.pros) {
<option value="#items.projectID">#items.projectName</option>
}
</select>
</td>
<input class="d-none" name="id" value="#item.id" />
<td>
<input type="hidden" class="hf_selected_val" value="#item.NoeaKhadmat" />
<select class="form-control" name="NoeaKhadmat" required autocomplete="off">
<option value="" default="" selected="">انتخاب کنید</option>
<option value="1">حسابرسی</option>
<option value="2">مالیاتی</option>
<option value="3">منابع انسانی</option>
</select>
</td>
<td><input class="form-control num" name="MablghGhrardad" onkeyup="javascript:this.value=itpro(this.value);" value="#item.MablghGhrardad" autocomplete="off" /></td>
<td><input class="form-control num" name="TadadJelse" autocomplete="off" value="#item.TadadJalaseDrMoaheGhrardad" /></td>
<td class="text-center">
<input type="checkbox" name="MashmolArzeshAfzoode" #(item.MashmolArzeshAfzoode ? "checked" : "") style="width: 1.25rem; height: 1.25rem; top: .8rem; " class="flat-red" value="True">
</td>
</tr>
<thead class="text-center mr-3">
<tr style="background-color:#416992; color: white">
<th>تاریخ شروع</th>
<th>تاریخ پایان</th>
<th style="background-color:darkgreen">تعین کارشناس</th>
<th colspan="2" class="text-center">عملیات</th>
</tr>
</thead>
<tr>
<td>
<div class="input-group" style="padding-left:9px; padding-right:9px;">
<div class="input-group-addon" style="border:1px solid gray; padding:6px">
<span> <i class="right fa fa-calendar"></i></span>
</div>
<input name="bgainDate2" id="bgainDate2#(count)" type="text" autocomplete="off" value=" #ConvertDateTime.ConvertMiladiToShamsi(item.ShoroeeProjectDate, " yyyy/MM/dd ")" class="form-control" />
</div>
</td>
<td>
<div class="input-group" style="padding-left:9px; padding-right:9px;">
<div class="input-group-addon" style="border:1px solid gray; padding:6px">
<span> <i class="right fa fa-calendar"></i></span>
</div>
<input name="EndDate2" id="EndDate2#(count)" type="text" autocomplete="off" value=" #ConvertDateTime.ConvertMiladiToShamsi(item.PayanProjectDate, " yyyy/MM/dd ")" class="form-control" />
</div>
</td>
<td>
<input type="hidden" class="hf_selected_val" value="#item.UserID" />
<select class="form-control" name="TaeenKarShnas" autocomplete="off">
<option value="" default="" selected="">انتخاب کنید</option>
#foreach (var items in ViewBag.userss) {
<option value="#items.Id">#items.FirstName #items.Family</option>
}
</select>
</td>
<td colspan="2" class="text-center">
<button type="submit" class="btn btn-success" style="color:white">ویرایش قرارداد</button>
</td>
</tr>
</table>
</form>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">بستن</button>
</div>
enter code here
</div>
</div>
</div>
#{count++;}
// this is internal css
<style>
body:not(.modal-open){
padding-right: 0px !important;
}
</style>

How to Save Customized Html widgets data in Drive data table

I have created HTML widgets (Calculator) to calculate per hour manpower effort, On Submit how can I save this data in Drive data table.
Using this data wants to genrate the workflow email.
<div class="gap10"></div>
<div class="container">
<table class="table table-bordered data" >
<thead>
<tr>
<th colspan="4"><h3 style="text-align: left;margin-top:0px; margin-bottom:0px;">Technology Design Services</h3></th>
</tr>
<tr class="one">
<th>Service Area</th>
<th>Per Hour Rate</th>
<th>Number Of Hours</th>
<th>Total Rate</th>
</tr>
</thead>
<tbody>
<tr>
<td>Contact Centre Expert</td>
<td><div class="form-group num">
<input name="" type="number" placeholder="" class="form-control input-md"id="PerHourRate1"type="text" value="2325" readonly>
</div></td>
<td><div class="form-group num">
<input name="" type="text" placeholder="" class="form-control input-md"value="0" id="rTpe1">
</div></td>
<td><div class="form-group num">
<input name="" type="text" placeholder="" class="form-control input-md"value="0" id="rFor1"readonly>
</div></td>
</tr>
<tr>
<td>Solution Design</td>
<td><div class="form-group num">
<input name="" type="number" placeholder="" class="form-control input-md"id="PerHourRate2"type="text" value="2762" readonly>
</div></td>
<td><div class="form-group num">
<input name="" type="text" placeholder="" class="form-control input-md"value="0"id="rTpe2">
</div></td>
<td><div class="form-group num">
<input name="" type="text" placeholder="" class="form-control input-md"value="0" id="rFor2"readonly>
</div></td>
</tr>
If you have Model with ServiceArea, PerHourRate, NumberOfHours fields then you can just drop a table on a page (table wizard allows to select which fields should be editable), add column for total rate and set binding for it to #datasource.item.PerHourRate * #datasource.item.NumberOfHours. With such setup changes made to NumberOfHours field will be automatically saved to database.
Note:
If you want to keep PerHourRate read only, be sure to implement server side validation for that in Model Events.

How to convert HTML table to List using Thymeleaf

I am creating an spring-boot MVC web application.
When I get the contents from the controller I can display them correctly on the view. The content is an object with a List. The list is displayed on a table.
<form th:action="#{/}" th:object="${homeVO}" method="post">
<div align="center">
<table width="80%" id="sectionsTable">
<thead>
<th width="10%"><label class="tableTextTitle">ORDER</label></th>
<th width="50%"><label class="tableTextTitle">TITLE</label></th>
<th width="10%"></th>
<th width="10%"><label class="tableTextTitle">HIDE</label></th>
<th width="10%"></th>
<th width="10%"></th>
</thead>
<tbody>
<tr th:each="section, stat :${homeVO.sections}">
<td>
<input type="number" th:value="${section.id}" hidden="true" id="sectionid" />
<input type="number" class="form-control" th:value="${section.position}" id="position"/>
</td>
<td>
<input type="text" class="form-control" th:value="${section.name}" disabled="true" id="name"/>
</td>
<td align="center">
<a th:href="#{./sectionprofile(id=${section.id})}" class="btn btn-default">EDIT</a>
</td>
<td>
<input type="text" class="form-control" th:value="${section.column}" id="column"/>
</td>
<td>
<select class="form-control" id="condition">
<option value="0" th:selected="(${section.condition} == 0)"/>
<option value="1" th:text="#{minor}" th:selected="(${section.condition} == 1)"/>
<option value="2" th:text='#{minorEq}' th:selected="(${section.condition} == 2)"/>
<option value="3" th:text="#{different}" th:selected="(${section.condition} == 3)"/>
<option value="4" th:text='#{equals}' th:selected="(${section.condition} == 4)"/>
<option value="5" th:text='#{biggerEq}' th:selected="(${section.condition} == 5)"/>
<option value="6" th:text='#{bigger}' th:selected="(${section.condition} == 6)"/>
</select>
</td>
<td>
<input type="text" class="form-control" th:value="${section.criteria}" id="criteria"/>
</td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-12">
Add Section
<input type="submit" class="btn btn-default" value="SAVE" />
</div>
</form>
When I change some values on the table I want to save them. When I save, I get in the controller the object with an empty List.
#RequestMapping(method = RequestMethod.POST)
public String set(HomeVO homeVO, Model model) {
if (homeVO != null) {
for (SectionVO sectionVO : homeVO.getSections()) {
Section section = sectionRepository.findOne(sectionVO.getId());
section.setPosition(sectionVO.getPosition());
section.setColumn(sectionVO.getColumn());
section.setCondition(sectionVO.getCondition());
section.setCriteria(sectionVO.getCriteria());
sectionRepository.save(section);
}
}
...
return "home";
}
What shall I do to get the table elements back into a List?
To accomplish this rows bindings properly follow the Thymeleaf Spring guide specificaly Dynamic Fields section. There is a special syntax so your HTML should be similar to this:
<tr th:each="row,rowStat : *{rows}">
<td th:text="${rowStat.count}">1</td>
<td>
<select th:field="*{rows[__${rowStat.index}__].variety}">
<option th:each="var : ${allVarieties}"
th:value="${var.id}"
th:text="${var.name}">Thymus Thymi</option>
</select>
</td>
<td>
<input type="text" th:field="*{rows[__${rowStat.index}__].seedsPerCell}" />
</td>
<td>
<button type="submit" name="removeRow"
th:value="${rowStat.index}" th:text="#{seedstarter.row.remove}">Remove row</button>
</td>
</tr>

Bootstrap class formatting breaking my Flask WTForms

I have this WTForms template which produces a simple form with text fields, radio buttons and a submit button.
{% extends "layout.html" %}
{% block content %}
<form action="{{ url_for('home') }}" method=post>
<h3>Part I,</h3><h4>G1</h4><div class="well span6">
{{ form.node_1.label }}
<form class="form-inline" role="form">
{% for subfield in form.freq_1 %}<tr><td>{{ subfield }}</td><td>{{ subfield.label }}</td></tr>{% endfor %}
</form></div><h4>G2</h4><div class="well span6">
{{ form.node_2.label }}
<form class="form-inline" role="form">
{% for subfield in form.freq_2 %}<tr><td>{{ subfield }}</td><td>{{ subfield.label }}</td></tr>{% endfor %}
</form></div>
<h3>Part II</h3>
<div class="well span6">
{{ form.extra1.label }} {{ form.extra1}}
{{ form.extra1Email.label }} {{ form.extra1Email }}
{{ form.extra1Group.label }} {{ form.extra1Group }}
<form class="form-inline" role="form">
{% for subfield in form.extra1Freq %}<tr><td>{{ subfield }}</td><td>{{ subfield.label }}</td></tr>{% endfor %}
</form>
</div>
<div class="well span6">
{{ form.extra2.label }} {{ form.extra2}}
{{ form.extra2Email.label }} {{ form.extra2Email }}
{{ form.extra2Group.label }} {{ form.extra2Group }}
<form class="form-inline" role="form">
{% for subfield in form.extra2Freq %}<tr><td>{{ subfield }}</td><td>{{ subfield.label }}</td></tr>{% endfor %}
</form>
</div>
{{ form.submit }}
</form>
{% endblock %}
Here's the html Flask produces:
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<link rel="stylesheet" href="/static/css/bootstrap.css">
</head>
<body>
<header>
<div class="container">
<h1 class="logo">Title</h1>
<nav>
<ul class="menu">
<li>Home
</li>
<li>Network
</li>
</ul>
</nav>
</div>
</header>
<div class="container">
<form action="/" method=post>
<h3>Part I,</h3>
<h4>G1</h4>
<div class="well span6">
<label for="node_1">First name 1 Last name 1</label>
<form class="form-inline" role="form">
<tr>
<td>
<input checked id="freq_1-0" name="freq_1" type="radio" value="0">
</td>
<td>
<label for="freq_1-0">1</label>
</td>
</tr>
<tr>
<td>
<input id="freq_1-1" name="freq_1" type="radio" value="1">
</td>
<td>
<label for="freq_1-1">2</label>
</td>
</tr>
<tr>
<td>
<input id="freq_1-2" name="freq_1" type="radio" value="7">
</td>
<td>
<label for="freq_1-2">3</label>
</td>
</tr>
<tr>
<td>
<input id="freq_1-3" name="freq_1" type="radio" value="30">
</td>
<td>
<label for="freq_1-3">4</label>
</td>
</tr>
<tr>
<td>
<input id="freq_1-4" name="freq_1" type="radio" value="183">
</td>
<td>
<label for="freq_1-4">5</label>
</td>
</tr>
<tr>
<td>
<input id="freq_1-5" name="freq_1" type="radio" value="365">
</td>
<td>
<label for="freq_1-5">6</label>
</td>
</tr>
</form>
</div>
<h4>G2</h4>
<div class="well span6">
<label for="node_2">First name 2 Last name 1</label>
<form class="form-inline" role="form">
<tr>
<td>
<input checked id="freq_2-0" name="freq_2" type="radio" value="0">
</td>
<td>
<label for="freq_2-0">1</label>
</td>
</tr>
<tr>
<td>
<input id="freq_2-1" name="freq_2" type="radio" value="1">
</td>
<td>
<label for="freq_2-1">2</label>
</td>
</tr>
<tr>
<td>
<input id="freq_2-2" name="freq_2" type="radio" value="7">
</td>
<td>
<label for="freq_2-2">3</label>
</td>
</tr>
<tr>
<td>
<input id="freq_2-3" name="freq_2" type="radio" value="30">
</td>
<td>
<label for="freq_2-3">4</label>
</td>
</tr>
<tr>
<td>
<input id="freq_2-4" name="freq_2" type="radio" value="183">
</td>
<td>
<label for="freq_2-4">5</label>
</td>
</tr>
<tr>
<td>
<input id="freq_2-5" name="freq_2" type="radio" value="365">
</td>
<td>
<label for="freq_2-5">6</label>
</td>
</tr>
</form>
</div>
<h3>Part II</h3>
<div class="well span6">
<label for="extra1">First and Last name:</label>
<input id="extra1" name="extra1" type="text" value="">
<label for="extra1Email">Email:</label>
<input id="extra1Email" name="extra1Email" type="text" value="">
<label for="extra1Group">Company or Group:</label>
<input id="extra1Group" name="extra1Group" type="text" value="">
<form class="form-inline" role="form">
<tr>
<td>
<input id="extra1Freq-0" name="extra1Freq" type="radio" value="1">
</td>
<td>
<label for="extra1Freq-0">1</label>
</td>
</tr>
<tr>
<td>
<input id="extra1Freq-1" name="extra1Freq" type="radio" value="7">
</td>
<td>
<label for="extra1Freq-1">2</label>
</td>
</tr>
<tr>
<td>
<input id="extra1Freq-2" name="extra1Freq" type="radio" value="30">
</td>
<td>
<label for="extra1Freq-2">3</label>
</td>
</tr>
<tr>
<td>
<input id="extra1Freq-3" name="extra1Freq" type="radio" value="183">
</td>
<td>
<label for="extra1Freq-3">4</label>
</td>
</tr>
<tr>
<td>
<input id="extra1Freq-4" name="extra1Freq" type="radio" value="365">
</td>
<td>
<label for="extra1Freq-4">5</label>
</td>
</tr>
</form>
</div>
<div class="well span6">
<label for="extra2">First and Last name:</label>
<input id="extra2" name="extra2" type="text" value="">
<label for="extra2Email">Email:</label>
<input id="extra2Email" name="extra2Email" type="text" value="">
<label for="extra2Group">Company or Group:</label>
<input id="extra2Group" name="extra2Group" type="text" value="">
<form class="form-inline" role="form">
<tr>
<td>
<input id="extra2Freq-0" name="extra2Freq" type="radio" value="1">
</td>
<td>
<label for="extra2Freq-0">1</label>
</td>
</tr>
<tr>
<td>
<input id="extra2Freq-1" name="extra2Freq" type="radio" value="7">
</td>
<td>
<label for="extra2Freq-1">2</label>
</td>
</tr>
<tr>
<td>
<input id="extra2Freq-2" name="extra2Freq" type="radio" value="30">
</td>
<td>
<label for="extra2Freq-2">3</label>
</td>
</tr>
<tr>
<td>
<input id="extra2Freq-3" name="extra2Freq" type="radio" value="183">
</td>
<td>
<label for="extra2Freq-3">4</label>
</td>
</tr>
<tr>
<td>
<input id="extra2Freq-4" name="extra2Freq" type="radio" value="365">
</td>
<td>
<label for="extra2Freq-4">5</label>
</td>
</tr>
</form>
</div>
<input id="submit" name="submit" type="submit" value="Send your form">
</form>
</div>
</body>
</html>
I use Bootstrap 3 to format the lists of buttons by attributing a class to parts of the form:
<form class="form-inline" role="form">
For some reasons, using these classes "breaks" my form, in that clicking the "submit" button doesn't register or lead anywhere. When I remove the above line (and their relative "") from the form, I am then able to submit.
What is wrong with my use of these Bootstrap classes? What is the proper way to use them?

html align column right

I have this Html code :
<tr>
<td>
<a type="text"
name="color" >#client.Login</a>
</td>
<td>
<a type="text"
name="color" >#client.Mail</a>
</td>
<td>
<a type="text"
name="color" >#client.Password</a>
</td>
<td>
<a type="text"
name="color" >#client.Name</a>
</td>
<td width=10px align="left">
#if (i == 0)
{
<input type="radio"
name="color" checked >
}
else
{<input type="radio" name="color" >
}
</td>
</tr>
My problem is in the radio button : it is so far to the other elements. the attribute align is obsolete in HTML5 .
the dimensions :
So how can modify this snippet to got a good result?
Use CSS text-align instead of align:
<td width=10px style="text-align: right;">
#if (i == 0)
{
<input type="radio" name="color" checked >
} else{
<input type="radio" name="color" >
}
</td>

Resources