How can I Add Custom Validation in Kendo Grid Popup - kendo-ui

How can I add validation for minimum length to a Textbox and display custom error messages?
I want validation for the following:
UserName to have a minimum length of 6
Password and Confirm Password to match
Address1 is required
Here is the code for the popup template. The specified minlength in the template is not working but the maxlength is working properly.
<script id="popup_editor" type="text/x-kendo-template">
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<label for="UserName"><b>UserName*</b></label>
</td>
<td>
<div class="control-row">
<input type="text"
name="UserName"
id="UserName"
class="k-input k-textbox"
required
**minLength**="6"
maxlength="8"
pattern="[a-zA-Z0-9]+"
validationMessage="Please enter username"/>
<span class="k-invalid-msg" data-for="UserName" ></span>
</div>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<div>
<label for="Password"><b>Password*</b></label>
</div>
</td>
<td>
<div class="k-edit-label">
<input type="password"
id="Password"
name="Password"
class="k-input k-textbox"required
validationMessage="Please enter Password"/>
<span class="k-invalid-msg" data-for="Password"></span>
</div>
</td>
<td>
<div>
<label for="ConfirmPassword" style=""><b>Confirm Password</b></label>
</div>
</td>
<td>
<div class="k-edit-label">
<input type="password"
id="ConfirmPassword"
name="ConfirmPassword"
class="k-input k-textbox"required
validationMessage="Please enter Confirm Password"/>
</div>
</td>
</tr>
<tr>
<td>
<div>
<label for="Company_Name"><b>Company Name*</b></label>
</div>
</td>
<td>
<div class="k-edit-label">
<input name="Company_Name"
id="Company_Name"
required
pattern="[a-zA-Z0-9]+"
validationMessage="Please enter Valid CompanyName"/>
</div>
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>
<div>
<label for="First_Name"><b>First Name*</b></label>
</div>
</td>
<td>
<div class="k-edit-label">
<input type="text"
name="First_Name"
id="First_Name"
data-type="string"
data-bind="value:First_Name"
class="k-input k-textbox" required
pattern="[a-zA-Z]+"
validationMessage="Please enter FirstName"/>
</div>
</td>
<td>
<div>
<label for="Last_Name"><b>Last Name*</b></label>
</div>
</td>
<td>
<div class="k-edit-label">
<input type="text"
id="Last_Name"
name="Last_Name"
class="k-input k-textbox" required
pattern="[a-zA-Z]+"
validationMessage="Please enter LastName"/>
</div>
</td>
</tr>
<tr>
<td>
<div>
<label for="Address1"><b>Address1*</b></label>
</div>
</td>
<td>
<div class="k-edit-label">
<textArea style="resize: none;"
rows="5"
cols="18"
name="Address1"
maxlength="150"
id="Address1" required
pattern="[a-zA-Z0-9]+"
validationMessage="Please enter Address">
</textarea>
</div>
</td>
</tr>
</table>

You can add custom validation for popup editing within the dataSource of your grid.
var dataSource = new kendo.data.DataSource({
transport: {
...
},
schema: {
model: {
id: "UserName",
fields: {
UserName: {}
Password: {}
ConfirmPassword: {}
Company_Name: {}
First_Name: {}
Last_Name: {}
Address1: {
validation: {
minLength: function (input) {
if (input.is("[name=UserName]")) {
return input.val().length >= 6;
}
return true;
},
match: function (input) {
if (input.is("[name=ConfirmPassword]")) {
return input.val() == $("#Password").val();
}
return true;
}
}
}
}
}
}
});
There are a few things to respect:
The validation runs for ALL input elements within your popup, therefore
you only have to define it for ONE of the fields in your model. Which one does not matter.
you have to check which input element is checked in the current run, which does the if statement in my example.
you have to append a return true at the end of each and every rule you define or otherwise you'll get an error message for every input you're not explicitly checking. If there's no return value passed, kendo automatically assumes the check had a false result.
Every validation rule needs its own validation message or otherwise your validation tooltip box will only display a warning logo without any text. You can add it as an html attribute (data-{validation rule}-msg) in your input elements, like this:
<input type="text"
name="UserName"
id="UserName"
class="k-input k-textbox"
required
maxlength="8"
pattern="[a-zA-Z0-9]+"
validationMessage="Please enter username"
data-minLenght-msg="Username must be at least 6 characters"/>
<input type="password"
id="ConfirmPassword"
name="ConfirmPassword"
class="k-input k-textbox"
required
validationMessage="Please enter Confirm Password"
data-match-msg="Password and confirmation must be equal"/>
Hope this helps

In rules add this:
match: function (input) {
if ((input.is('[name=\'Password\']') || input.is('[name=\'ConfirmPassword\']'))&& $('#ConfirmPassword').length !== 0) {
if ($('#Password').val().length > 0 && $('#ConfirmPassword').val().length > 0) {
if (input.is('[name=\'Password\']')) {
return input.val() === $('#ConfirmPassword').val();
}
else if (input.is('[name=\'ConfirmPassword\']')) {
return input.val() === $('#Password').val();
}
}
}
return true;
},
minLength: function (input) {
if (input.is("[name=UserName]")) {
return input.val().length >= 6;
}
return true;
},
requiredAddress: function (input) {
if (input.is("[name=Address1]")) {
return $('#Address1').val() !== '' ? false : true;
}
return true;
}

Related

laravel and vuejs post method

I need your help I'm making a shopping cart in laravel with vuejs.
I have the following problem I am new to vuejs I am inserting products from a component A where is my form in vue I insert it but I have no response in my component B where is my table where the products are registered, be careful if you add the detail is that I have to reload the page to see that the number of products increased.
I am using EventBus from vuejs
I hope you can help me thanks for any help
this is my form
<form method="post" v-on:submit.prevent>
<input :value="csrf" type="hidden" name="_token" >
<input :model="ProductSearch.id" name="id" type="hidden" class="form-control input-lg">
<input :value="ProductSearch.name" name="name" type="hidden" class="form-control input-lg">
<input :value="ProductSearch.sale_price" name="precio" type="hidden" class="form-control input-lg">
<input :value="1" name="cantidad" type="number" class="form-control input-lg" min="1" style="text-align:center" >
<button v-on:click="addproduct" class="btn btn-info btn-block" name="btnAccion" value="Agregar" type="submit"> Add</button>
</form>
This is my method
addproduct: async function () {
axios.post('sales/item', {
id: this.id,
name: this.name,
precio: this.precio,
cantidad: this.cantidad,
})
.then(function(response){
EventBus.$emit('agregado', response.data)
})
.catch(error => {
console.log(error.response);
});
}
this is my table where I reflect my result.
<tbody >
<tr v-for="(ProductCart, index) in carrito" :key="index.id">
<td>{{ProductCart.name}}</td>
<td>{{ProductCart.cantidad}}</td>
<td>{{ProductCart.precio}}</td>
<td>{{ProductCart.cantidad * ProductCart.precio}}</td>
<td>
<form method="post">
<input :value="csrf" type="hidden" name="_token" >
<input type="hidden" name="id" id="id" value="" >
<button class="btn btn-danger" type="submit"> Remove</button>
</form>
</td>
</tr>
<tr>
<th colspan="2"></th>
<td>
<h5>Total</h5>
</td>
<td align="right">
<h5>{{ total }}</h5>
</td>
</tr>
</tbody>
scrip of component of the table
data(){
return{
csrf: document.head.querySelector('meta[name="csrf-token"]').content,
carrito: [],
}
},
created(){
EventBus.$on('agregado', data => {
this.carrito.push(data)
})
},
in my console I receive the error:
Error in event handler for "agregado": "TypeError: _this.carrito.push is not a function"

Unable to bind the Radio button and checkbox data on button click in react hooks

I am having a form, When I submit the data it is going to server and I displayed the data in a table..
In the Table I am having edit button, When clicked on Edit button, the data should bind to the Form.
Here I am unable to bind the Inputs fields, but not the Radio and Checkboxes...
const Form = () => {
const [data, setdata] = useState({
"UserName" : "",
"dropDown" :"",
"gender" : "",
"checking" :""
})
const [update, setUpdate] = useState([])
const handleChange =(e)=>{
if(e.target.name !=="gender" && e.target.name !=="checking"){
setdata({...data,[e.target.name]:e.target.value});
}else if(e.target.name ==="gender"){
let allgenders = document.getElementsByName("gender");
allgenders.forEach((allradio)=>{
if(allradio.checked){
setdata({...data,[e.target.name]:e.target.value});
}
})
}else if(e.target.name ==="checking"){
let getallCheckboxes =[];
let allCheckboxes =document.getElementsByName("checking");
allCheckboxes.forEach((allchecks)=>{
if(allchecks.checked){
getallCheckboxes.push(allchecks.value)
}
});
setdata({...data,[e.target.name]:getallCheckboxes});
}
}
useEffect(() => {
getAllData();
}, [])
const handleSubmit=(e)=>{
e.preventDefault();
// setUpdate({...data,update});
// console.log(data);
axios.post('http://localhost:3000/users',data).then((res)=>{
// console.log("user added successfully");
getAllData();
handleClear();
})
}
const getAllData=()=>{
axios.get('http://localhost:3000/users').then((res)=>{
setUpdate(res.data);
})
}
const deleteUser=(dating)=>{
console.log(dating);
axios.delete('http://localhost:3000/users/'+dating.id).then(res=>{
getAllData();
})
}
This is the Funtions for Edit and update,Here I am able to bind the Inputs fields, but not the Radio and Checkboxes...
const editUser=(userData)=>{
setdata(userData)
}
const handleEdit=()=>{
console.log(data);
axios.put('http://localhost:3000/users/'+data.id,data).then(res=>{
getAllData();
})
}
return (
<React.Fragment>
<h1>LordShiva</h1>
<div className="container mt-3">
<div className="row">
<div className="col-md-6">
<div className="card">
<div className="card-header bg-success text-white">
<h4>Form</h4>
<form>
<div className="form-group">
<input type="text" className="form-control" placeholder='UserName' name="UserName" value={data.UserName} onChange={handleChange} />
</div>
<div className="form-group">
<input name="phone" className="form-control" placeholder='PhoneNumber' name="PhoneNumber" value={data.PhoneNumber} onChange={handleChange} />
</div>
<div className="form-group">
<input name="email" className="form-control" placeholder='Email' value={data.email} onChange={handleChange} />
</div>
<div className="form-group">
<select name="dropDown" value={data.dropDown} onChange={handleChange} className="form-control" >
<option value=""></option>
<option value="Reactjs">ReactJS</option>
<option value="JS">JavaScript</option>
<option value="csCSSs">CSS</option>
<option value="HTML">HTML</option>
</select>
</div>
<div class="form-row">
<div className="form-group col-md-6">
<label className="font-weight-bold">Gender : </label>
<span className="font-weight-bold" > Male <input type="radio" name="gender" value={data.gender} onChange={handleChange}/></span>
<span className="font-weight-bold" > Female <input type="radio" name="gender" value={data.gender} onChange={handleChange} /></span>
</div>
<div class="form-check col-md-6">
<label class="form-check-label" for="gridCheck">Course</label><br />
<input type="checkbox" value="HTML" name="checking" value={data.checking} onChange={handleChange} /> HTML <br />
<input type="checkbox" value="JavaScript" name="checking" value={data.checking} onChange={handleChange} /> JavaScript <br />
<input type="checkbox" value="ReactJS" name="checking" value={data.checking} onChange={handleChange} /> ReactJS <br />
<input type="checkbox" value="CSS" name="checking" value={data.checking} onChange={handleChange} /> CSS <br />
</div>
<div className="form-row">
<button className="btn btn-cyan" type="button" onClick={handleSubmit}>Submit</button>
<button className="btn btn-cyan" type="button" onClick={handleEdit}>UpdateData</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div className="col-md-12">
<div className="card mt-5">
<div className="card-header blue-gradient text-white">
<h4>FormDetails</h4>
<div>
<div className="row mt-3">
<div className="col">
<div className="table table-hover table-striped text-center table-primary">
<thead className="bg-dark text-white font-weight-bold">
<tr>
<th>UserName</th>
<th>DropDownValue</th>
<th>Gender</th>
<th>CheckboxValue</th>
<th>EDIT</th>
<th>DELETE</th>
</tr>
</thead>
<tbody>
{
update.map(emp => {
return(
<tr>
<td>{emp.UserName} </td>
<td>{emp.gender}</td>
<td>{emp.checking}</td>
<td><button className="btn btn-cyan font-weight-bold" onClick={()=>{editUser(emp)}}>Edit</button></td>
<td><button className="btn btn-green font-weight-bold" onClick={()=>{deleteUser(emp)}}>Delete</button></td>
</tr>
)
})
}
</tbody>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</React.Fragment >
)
}
Change state to
const [data, setdata] = useState({
UserName: "",
dropDown: "",
gender: null,
checking: []
});
Update the handler to access the radio and checkbox id attributes
const handleChange = (e) => {
if (e.target.name !== "gender" && e.target.name !== "checking") {
setdata({ ...data, [e.target.name]: e.target.value });
} else if (e.target.name === "gender") {
let allgenders = document.getElementsByName("gender");
allgenders.forEach((allradio) => {
if (allradio.checked) {
setdata({ ...data, [e.target.name]: e.target.id }); // <-- grab input id
}
});
} else if (e.target.name === "checking") {
let getallCheckboxes = [];
let allCheckboxes = document.getElementsByName("checking");
allCheckboxes.forEach((allchecks) => {
if (allchecks.checked) {
getallCheckboxes.push(allchecks.id); // <-- grab checkbox id
}
});
setdata({ ...data, [e.target.name]: getallCheckboxes });
}
};
Update/add handleClear to reset the state
handleClear = () => {
setdata({
UserName: "",
dropDown: "",
gender: null,
checking: []
});
};
Add id properties and change the value prop to checked and pass a boolean value
<label className="font-weight-bold">Gender : </label>
<span className="font-weight-bold">
<label>
Male
<input
id="male"
type="radio"
name="gender"
checked={data.gender === "male"}
onChange={handleChange}
/>
</label>
</span>
<span className="font-weight-bold">
<label>
Female
<input
id="female"
type="radio"
name="gender"
checked={data.gender === "female"}
onChange={handleChange}
/>
</label>
</span>
...
<label class="form-check-label" for="gridCheck">
Course
</label>
<br />
<label>
<input
id="HTML"
type="checkbox"
name="checking"
checked={data.checking.includes("HTML")}
onChange={handleChange}
/>
HTML
</label>
<br />
<label>
<input
id="JavaScript"
type="checkbox"
name="checking"
checked={data.checking.includes("JavaScript")}
onChange={handleChange}
/>
JavaScript
</label>
<br />
<label>
<input
id="ReactJS"
type="checkbox"
name="checking"
checked={data.checking.includes("ReactJS")}
onChange={handleChange}
/>
ReactJS
</label>
<br />
<label>
<input
id="CSS"
type="checkbox"
name="checking"
checked={data.checking.includes("CSS")}
onChange={handleChange}
/>
CSS
</label>

Unable to filter the nested object in Angular 7 using Primeng Turbo Table

I was trying to display nested objects returned from web api in json format into the turbo table i.e p-table, a Primeng component. After successful displayed all the data, I tried with column filter, in which I managed to filter out the parent object but now struggling to filter the child or nested objects in the array.
Below is that I've done so far.
SubscriptionlistComponent.ts
loadAllSubscriptions(): any {
this.spinner.show();
this.subscriptionService.getAllSubscriptions().subscribe(data => {
//subscription.lstSubscription = data;
this.subscriptionLst = data;
//console.log(this.subscriptionLst);
//this.lstsubscriptions = this.filter.valueChanges.pipe(
// startWith(''),
// map(text => this.search(text, this.pipe, this.datepipe))
//);
this.totalSubscriptions = data.length;
this.spinner.hide();
});
FilterUtils['custom'] = (value, filter): boolean => {
if (filter === undefined || filter === null || filter.trim() === '') {
return true;
}
if (value === undefined || value === null) {
return false;
}
return parseInt(filter) > value;
}
this.cols = [
{ field: 'DateTime', header: 'Date' },
{ field: 'Driver', subfield: 'FirstName', header: 'Driver' },
{ field: 'paymentMode', subfield : 'Title', header: 'Mode' },
{ field: 'startDate', header: 'Start Date' },
{ field: 'endDate', header: 'End Date' },
{ field: 'Amount', header: 'Amount' }
];
}
And this is my component.html code
<div class="content-section implementation ui-fluid">
<p-table #dt [columns]="cols" [value]="subscriptionLst"
[paginator]="true" [rows]="10">
<ng-template pTemplate="caption">
<div style="text-align: right">
<i class="fa fa-search" style="margin:4px 4px 0 0"></i>
<input type="text" pInputText size="50" placeholder="Global Filter" (input)="dt.filterGlobal($event.target.value, 'contains')" style="width:auto">
</div>
</ng-template>
<ng-template pTemplate="header" let-columns>
<tr>
<th *ngFor="let col of columns">
{{col.header}}
</th>
</tr>
<tr>
<th *ngFor="let col of columns" [ngSwitch]="col.field">
<input *ngSwitchCase="'DateTime'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, 'contains')">
<div *ngSwitchCase="'Driver'" [ngSwitch]="col.subfield">
<input *ngSwitchCase="'FirstName'" pInputText type="text" (input)="dt.filter($event.target.value, col.subfield, 'contains')">
</div>
<div *ngSwitchCase="'paymentMode'" [ngSwitch]="col.subfield">
<input *ngSwitchCase="'Title'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, 'contains')">
</div>
<input *ngSwitchCase="'startDate'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, 'contains')">
<input *ngSwitchCase="'endDate'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, 'contains')">
<input *ngSwitchCase="'Amount'" pInputText type="text" (input)="dt.filter($event.target.value, col.field, 'contains')">
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rowData let-columns="columns">
<tr [pSelectableRow]="rowData">
<td *ngFor="let col of columns">
<div *ngIf="col.subfield;then nested_object_content else normal_content"></div>
<ng-template #nested_object_content>
{{rowData[col.field][col.subfield]}}
</ng-template>
<ng-template #normal_content>
{{rowData[col.field]}}
</ng-template>
</td>
</tr>
</ng-template>
</p-table>
</div>
I figured out issue by my own self. Hopefully this would help others who would tackle with this situation.
All I just had to do was replace the col.subfield with the actual object and nested object name.
Replace
dt.filter($event.target.value, col.subfield, 'contains')
with
dt.filter($event.target.value, 'Driver.FirstName', 'contains')
Switch Case
<div [ngSwitch]="col.subfield">
<input *ngSwitchCase="'FirstName'" pInputText type="text" (input)="dt.filter($event.target.value, 'Driver.FirstName', 'contains')">
</div>
And that's it...

Vue.js - Buefy Modules (Radio btns/ Check Box)

I'm practising back-end in Laravel, and for front-end I'm using Vue.js - Buefy Modules, and I have little problem with Radio and CheckBox.
Here User should choose one of the two offered radio btns:
<div class="block">
<b-radio-group v-model="permissionType">
<b-radio name="permission_type" value="basic">Basic Permission</b-radio>
<b-radio name="permission_type" value="crud">CRUD Permission</b-radio>
</b-radio-group>
</div>
If User click on first btun (Basic) there should appear 3 input fields:
<div class="field" v-if="permissionType == 'basic'">
<label for="display_name" class="label">Name (Display Name)</label>
<p class="control">
<input type="text" class="input" name="display_name" id="display_name">
</p>
</div>
<div class="field" v-if="permissionType == 'basic'">
<label for="name" class="label">Slug</label>
<p class="control">
<input type="text" class="input" name="name" id="name">
</p>
</div>
<div class="field" v-if="permissionType == 'basic'">
<label for="description" class="label">Description</label>
<p class="control">
<input type="text" class="input" name="description" id="description" placeholder="Describe what this permission does">
</p>
</div>
If User click on second btn (CRUD) there should appear 1 input, 4 check box btns and table, but they do not appear.
<div class="field" v-if="permissionType == 'crud'">
<label for="resource" class="label">Resource</label>
<p class="control">
<input type="text" class="input" name="resource" id="resource" v-model="resource" placeholder="The name of the resource">
</p>
</div>
<div class="columns" v-if="permissionType == 'crud'">
<div class="column is-one-quarter">
<b-checkbox-group v-model="crudSelected">
<div class="field">
<b-checkbox custom-value="create">Create</b-checkbox>
</div>
<div class="field">
<b-checkbox custom-value="read">Read</b-checkbox>
</div>
<div class="field">
<b-checkbox custom-value="update">Update</b-checkbox>
</div>
<div class="field">
<b-checkbox custom-value="delete">Delete</b-checkbox>
</div>
</b-checkbox-group>
</div> <!-- end of .column -->
<input type="hidden" name="crud_selected" :value="crudSelected">
<div class="column">
<table class="table" v-if="resource.length >= 3">
<thead>
<th>Name</th>
<th>Slug</th>
<th>Description</th>
</thead>
<tbody>
<tr v-for="item in crudSelected">
<td v-text="crudName(item)"></td>
<td v-text="crudSlug(item)"></td>
<td v-text="crudDescription(item)"></td>
</tr>
</tbody>
</table>
</div>
</div>
I've checked Buefy documentation and there were some updates, but when I change code, still not works..
Here is script:
<script>
var app = new Vue({
el: '#app',
data: {
permissionType: 'basic',
resource: '',
crudSelected: ['create', 'read', 'update', 'delete']
},
methods: {
crudName: function(item) {
return item.substr(0,1).toUpperCase() + item.substr(1) + " " + app.resource.substr(0,1).toUpperCase() + app.resource.substr(1);
},
crudSlug: function(item) {
return item.toLowerCase() + "-" + app.resource.toLowerCase();
},
crudDescription: function(item) {
return "Allow a User to " + item.toUpperCase() + " a " + app.resource.substr(0,1).toUpperCase() + app.resource.substr(1);
}
}
});
</script>
Here I place original code without changes, if someone could fix this, I would be grateful. Thanks!
you forget to add v-model to your radio group, try this and it should work
<div class="block">
<b-radio-group v-model="permissionType">
<b-radio v-model="permissionType" name="permission_type" native-value="basic">Basic Permission</b-radio>
<b-radio v-model="permissionType" name="permission_type" native-value="crud">CRUD Permission</b-radio>
</b-radio-group>

How to add an increment value for each id attribute within the div contents with cloned jQuery object

Having a hard time figuring out how to add an increment value for each id attribute within the div contents with cloned jQuery object.
http://jsfiddle.net/hvK8d/
===================== HTML=====================
<div class="upload-file-container">
<div class="uploadFile left clearfix">
<input type="file" id="FileUpload1">
<table id="RadioButtonList1">
<tbody>
<tr>
<td><input type="radio" value="Resume" id="RadioButtonList1_1">
<label for="RadioButtonList1_1">Resume</label></td>
<td><input type="radio" value="Letter of Recommendation" id="RadioButtonList1_2">
<label for="RadioButtonList1_2">Letter of Recommendation</label></td>
<td><input type="radio" value="Other" id="RadioButtonList1_3">
<label for="RadioButtonList1_3">Other</label></td>
</tr>
</tbody>
</table>
</div>
Remove </div>
<div class=""><a class="plus" href="javascript:;">plus one</a></div>
===================== JQUERY =====================
//Cloning upload file control
$('.remove').live('click', function () {
if (confirm("Are you sure you wish to remove this item?")) {
$(this).parent().slideUp('fast', function () {
$(this).remove();
});
}
return false;
});
$('.plus').click(function () {
console.log('cloning');
var divCloned = $('.upload-file-container:first').clone();
divCloned.hide().insertAfter('.upload-file-container:last').slideDown('fast');
return false;
});
For the sake of completeness I will put here a small solution making use of a "template."
A class for hiding the template:
.upload-file-container.template {
display: none;
} ​
A small function to do replacements:
$.fn.template = function(variables) {
return this.each(function() {
this.innerHTML = this.innerHTML.replace(/{{(.+)}}/g, function(match, variable) {
return variables[variable];
});
return this;
});
};
A template:
<div class="upload-file-container template">
<div class="uploadFile left clearfix">
<input type="file" id="FileUpload{{id}}">
<table id="RadioButtonList{{id}}"><tbody>
<tr>
<td>
<input type="radio" value="Resume" id="RadioButtonList{{id}}_1">
<label for="RadioButtonList{{id}}_1">Resume</label>
</td>
</tr>
</tbody></table>
</div>
</div>
Usage:
var count = 0;
var divCloned = $(".upload-file-container.template")
.clone()
.removeClass("template")
.template({
id: count++
});
Instead of using numbered IDs, you should be using the array-like notation (e.g. RadioButtonList[]) in the name attribute, and wrap your labels around the inputs:
<td>
<label for="RadioButtonList1_1">
<input type="radio" value="Resume" name="RadioButtonList1[]">
Resume
</label>
</td>
<td>
<label for="RadioButtonList1_2">
<input type="radio" value="Letter of Recommendation" name="RadioButtonList2[]">
Letter of Recommendation
</label>
</td>
<td>
<label for="RadioButtonList1_3">
<input type="radio" value="Other" name="RadioButtonList3[]">
Other
</label>
</td>
P.S. You should also consider using a more descriptive name than RadioButtonList.

Resources