I make a tab panel and declare it as form type, then i put validation ng-disabled in button& tab. i want the button available after i finish fill up two form,my button is disabled at first but when i finish fill up "first" form then it able to clicked. And also tab, it never disabled...
<div class="panel-body">
<form class="tab-content form-horizontal"name="formData" novalidate>
<div id="form-views" ui-view></div>
</form>
here my code:
button
<button type="button" ng-click="addPost()"
ngdisabled="formData.$invalid" class="btn btn-success">Submit
</button>
tab
<div class="col-lg-12 col-sm-12">
<div class="row">
<div class="col-lg-8 col-sm-8">
<div class="panel panel-tab rounded shadow">
<div class="panel-heading1 no-padding">
<ul class="nav nav-tabs nav-pills">
<li class="active" ui-sref=".personal" >
<a data-toggle="tab">
<i class="fa fa-user"></i>
<div>
<span class="text-strong">Step 1</span>
<span>Personal</span>
</div>
</a>
</li>
<li class="" ui-sref-active="active" ui-sref=".test" ng-disabled="formData.$invalid">
<a data-toggle="tab" >
<i class="fa fa-file-text"></i>
<div >
<span class="text-strong">Step 2</span>
<span>Test Date</span>
</div>
</a>
</li>
<li class="" ui-sref-active="active" ui-sref=".testDetail">
<a data-toggle="tab" >
<i class="fa fa-credit-card"></i>
<div>
<span class="text-strong">Step 3</span>
<span>Test Details</span>
</div>
</a>
</li>
</ul>
</div>
<div class="panel-sub-heading">
<div class="inner-all">
<progressbar class="progress-striped active no-margin progress-xs" value='20' max="100" type="success"><i></i></progressbar>
</div>
</div>
<div class="panel-body">
<form class="tab-content form-horizontal" name="formData"novalidate>
<div id="form-views" ui-view></div>
</form>
</div>
</div>
</div>
this is my "personal details" tab
<div class="tab-pane inner-all" id="tab3-1">
<h4 class="page-header">Personal</h4>
<div class="form-group">
<label class="col-sm-2">Name</label>
<div class="col-sm-6" ng-class="{ 'has-error' : formData.name.$invalid && !formData.name.$pristine }">
<input class="form-control" name="name" placeholder="Enter name" ng-model="formData.ngCandName" required>
<p ng-show="formData.name.$invalid && !formData.name.$pristine" class="help-block">Candidate name is required.</p>
</div>
</div>
<div class="form-group" ng-class="{ 'has-error' : formData.background.$invalid && !formData.background.$pristine }">
<label class="col-sm-2">University</label>
<div class="col-sm-6">
<input class="form-control" name="background" placeholder="Background" ng-model="formData.ngCandBackg" required>
<p ng-show="formData.background.$invalid && !formData.background.$pristine" class="help-block">Candidate background is required.</p>
</div>
</div>
<div class="form-group mb-0" >
<label class="col-sm-2">Gender</label>
<div class="col-sm-6" >
<div class="rdio rdio-theme inline mr-10">
<input type="radio" id="male3" ng-model="formData.gender" name="radio" value="male" required >
<label for="male3">Male</label>
</div>
<div class="rdio rdio-theme inline">
<input type="radio" id="female3" name="radio" ng-model="formData.gender" value="female" required>
<label for="female3">Female</label>
</div>
</div>
</div>
<div class="form-group" ng-class="{ 'has-error' : formData.tel.$invalid && !formData.tel.$pristine }">
<label class="col-sm-2" >Telephone number</label>
<div class="col-sm-6">
<input type="number" ng-maxlength="11" class="form-control" name="tel" placeholder="Telephone number" ng-model="formData.ngCandTel" required>
<p ng-show="((formData.tel.$invalid && !formData.tel.$pristine))" class="help-block">Please insert telephone number.</p>
</div>
</div>
<div class="form-group" ng-class="{ 'has-error' : formData.Email.$invalid && !formData.Email.$pristine }">
<label class="col-sm-2">Email</label>
<div class="col-sm-6">
<input type="email" class="form-control" name="Email" placeholder="Email" ng-model="formData.ngCandEmail" required>
<p ng-show="formData.Email.$error.email" class="help-block">Candidate Email is invalid.</p>
</div>
</div>
Related
When I try to access user.firstname value in controller, it gives the following error.
TypeError: Cannot read property 'firstname' of undefined
$scope.signUpCustomer = function(){
console.log("GGGGGGGGGGGGGGGGGGGGGGGGG ", $scope.user.firstname);
}
<form class="form-horizontal font-hp-simplified signUpUserForm row" role="form" ng-submit="signUpCustomer()" name ="signUpUserForm" ng-show="!userVendor">
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group">
<label for="firstname" class="col-md-12">First Name:</label>
<div class="col-md-12">
<input ng-model="user.firstname" type="text" class="form-control" name="firstname" required />
<span class="text-danger" ng-show="signUpUserForm.firstname.$invalid && signUpUserForm.firstname.$dirty ">First name is required</span>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="lastname" class="col-md-12">Last Name:</label>
<div class="col-md-12">
<input ng-model="user.lastname" type="text" class="form-control" name="lastname" required />
<span class="text-danger" ng-show="signUpUserForm.lastname.$invalid && signUpUserForm.lastname.$dirty ">Last name is required</span>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group">
<label for="email" class="col-md-12">Email:</label>
<div class="col-md-12">
<input ng-model="user.email" type="email" class="form-control" name="email" required />
<span class="text-danger" ng-show="signUpUserForm.email.$error.required && signUpUserForm.email.$dirty ">Email is required</span>
<span class="text-danger" ng-show="signUpUserForm.email.$error.email && signUpUserForm.email.$dirty ">Please enter valid email</span>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="password" class="col-md-12">Password:</label>
<div class="col-md-12">
<input ng-model="user.password" type="password" class="form-control" name="password" required />
<span class="text-danger" ng-show="signUpUserForm.password.$invalid && signUpUserForm.password.$dirty">Password is required</span>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="form-group">
<label for="phone" class="col-md-12">Phone:</label>
<div class="col-md-12">
<input ng-model="user.phone" type="text" class="form-control" name="phone" required />
<span class="text-danger" ng-show="signUpUserForm.phone.$invalid && signUpUserForm.phone.$dirty">Phone is required</span>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="country" class="col-md-12">Country:</label>
<div class="col-md-12">
<select name="country" ng-model="user.country" type="text" class="form-control form-bg-white" required>
<!-- <option value="" disabled selected>Select Your Country</option> -->
<option value="" disabled selected></option>
<option ng-repeat="country in countries" value="{{country}}">{{country}}</option>
</select>
<span class="text-danger" ng-show="signUpUserForm.country.$invalid && signUpUserForm.country.$dirty">Country is required</span>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-12">
<!-- Button -->
<div class="form-group">
<div class="col-md-12">
<div class="icon-user-signup">
<div class="input-group-addon">
<i class="fa fa-user"></i>
</div>
<button id="btn-signup" class="btn btn-primary col-md-12">SIGN UP</button>
</div>
</div>
<!-- <div class="mrg-top-10 col-md-12 text-right">
<h4><a ng-click="go('/seller#/signup')" class="ven-link">
Become a vendor today
</a></h4>
</div>-->
</div>
</div>
</div>
<!-- <div class="col-md-12 control">
<div class="signup-border" >
Already have an account ?
<a ui-sref="loginUser" >
Sign In Here
</a>
</div>
</div> -->
</form>
You need to initialize the $scope.customer first in controller
$scope.user = {};
I am trying to create a form that changes tabs of login and signup that is working fine but the validations that i have used in the code are not working . I have created the controller but still the code is not working. Please have a look at the code and suggest the problem and solution for this problem.
<body ng-app="myApp" ng-controller="panelController as panel">
<div class="row no-gutters">
<div class="col">
<div class="container-fluid">
<nav class="navbar navbar-expand-lg">
<a class="navbar-brand mx-auto" href="#"><img class="brand-image"
src="images/recruitment.png">JobsFinder</a>
</nav>
<div class="logo-text">
<h3>The easiest way to get you new job</h3>
<p>We offer 12000 jobs vacation right now</p>
</div>
</div>
</div>
<div class="col">
<section>
<div class="form animated flipInX">
<ul class="tab-group">
<li class="tab" ng-class="{active: panel.isSelected(2)}"><a
href ng-click="panel.selectTab(2)">Log In</a></li>
<li class="tab" ng-class="{active: panel.isSelected(1)}"><a
href class="test" ng-click="panel.selectTab(1)">Sign Up</a></li>
</ul>
<div class="tab-content">
<div id="signup" ng-show="panel.isSelected(1)" >
<h3>Sign Up for Free</h3>
<form name="signupForm" class="signupForm" novalidate>
<div class="top-row">
<div class="field-wrap">
<input type="text" required autocomplete="off"
placeholder="First name" ng-model="fname">
<span style="color:red" ng-
show="signupForm.fname.$dirty && signupForm.fname.$invalid">
<span ng-
show="signupForm.fname.$error.required">First name is required.</span>
</span>
</div>
<div class="field-wrap">
<input type="text"required autocomplete="off"
placeholder="Last name" ng-model="lname">
<span style="color:red" ng-
show="signupForm.lname.$dirty && signupForm.lname.$invalid">
<span ng-
show="signupForm.lname.$error.required">Last name is required.</span>
</span>
</div>
</div>
<div class="field-wrap">
<input type="email" required autocomplete="off"
placeholder="Email" ng-model="signupemail">
<span style="color: indianred" ng-
show="signupForm.signupemail.$dirty && signupForm.email.$invalid">
<span ng-
show="signupForm.signupemail.$error.required">Email is required</span>
<span ng-
show="signupForm.signupemail.$error.email">Invalid email</span>
</span>
</div>
<div class="field-wrap">
<input type="password"required autocomplete="off"
placeholder="Password" ng-model="signpassword">
<span style="color: indianred" ng-
show="signupForm.signpassword.$dirty && signupForm.signpassword.$invalid">
<span ng-
show="signupForm.signpassword.$error.required">Password is required</span>
</span>
</div>
<div class="field-wrap">
<input type="password"required autocomplete="off"
placeholder="Confirm password" ng-model="cpass">
<span style="color: indianred" ng-
show="signupForm.cpass.$dirty && signupForm.cpass.$invalid">
<span ng-
show="signupForm.cpass.$error.required">Password is required</span>
</span>
</div>
<button type="submit" class="button button-block" ng-
click="submit()" ng-disabled="signupForm.signpassword.$dirty &&
signupForm.signpassword.$invalid || signupForm.signupemail.$dirty &&
signupForm.signupemail.$invalid || signupForm.cpass.$dirty &&
signupForm.cpass.$invalid"/>Get Started</button>
</form>
</div>
<div id="login" ng-show="panel.isSelected(2)" >
<h3>Welcome Back!</h3>
<form class="loginForm" name="loginForm" novalidate>
<div class="field-wrap">
<input type="email"required autocomplete="off"
placeholder="Email" ng-model="loginemail">
<span style="color: indianred" ng-
show="loginForm.loginemail.$dirty && loginForm.email.$invalid &&
loginForm.loginemail.$touched">
<span ng-
show="loginForm.loginemail.$error.required">Email is required</span>
<span ng-
show="loginForm.loginemail.$error.email">Invalid email</span>
</span>
</div>
<div class="field-wrap">
<input type="password"required autocomplete="off"
placeholder="Password" ng-model="logpassword">
<span style="color: indianred" ng-
show="loginForm.logpassword.$dirty && loginForm.logpassword.$invalid">
<span ng-
show="loginForm.logpassword.$error.required">Password is required</span>
</span>
</div>
<p class="forgot">Forgot Password?</p>
<button class="button button-block" type="submit" ng-
click="submit()" ng-disabled="loginForm.logpassword.$dirty &&
loginForm.logpassword.$invalid || loginForm.loginemail.$dirty &&
loginForm.loginemail.$invalid"/>Log In</button>
</form>
</div>
</div>
</div>
</section>
</div>
</div>
<footer>
<div class="text-center">
<p>Copyright © JobFinder 2017. Developed by Avneet Virk &
Shubham Dobriyal</p>
</div>
</footer>
<script src="https://unpkg.com/ionicons#4.2.2/dist/ionicons.js"></script>
<script src="js/panelController.js"></script>
</body>
You haven't specified any name for your inputs. So they're not correctly registered, underthat (absent) name in the form, so signupForm.fname (for example), is undefied.
Inputs must have a name:
<input name="fname" type="text" ... >
i am new to Angular js i want to ask i have a case in which i have to return "YES" if the checkbox is checked or true and want to return "NO" when the value is false or unchecked.
actually my data is storing in databse in "Tinyint" 1 or 0 form i want to do when 1 occurs it shows YES any solution for this Any help will be appreciated.
Here is my html
<form class="form-horizontal">
<div class="form-group">
<label class="col-lg-2 control-label">Name</label>
<div class="col-lg-10">
<input type="text" ng-model="rec.Name" placeholder="Name" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<div class="checkbox c-checkbox">
<label>
<input type="checkbox" value="" ng-model="rec.isSpecial">
<span class="fa fa-check"></span>is Special</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<div class="checkbox c-checkbox">
<label>
<input type="checkbox" ng-model="rec.isMultiple">
<span class="fa fa-check"></span>Is Multiple</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button type="button" ng-click="add(rec)" class="btn btn-sm btn-primary">ADD</button>
</div>
</div>
</form>
i need to target checkbox ismultiple and isspecial .
You can use ng-true-value of ng-false-value like this:
<form class="form-horizontal">
<div class="form-group">
<label class="col-lg-2 control-label">Name</label>
<div class="col-lg-10">
<input type="text" ng-model="rec.Name" placeholder="Name" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<div class="checkbox c-checkbox">
<label>
<input type="checkbox" ng-model="rec.isSpecial" ng-true-value = "YES" ng-false-value="NO">
<span class="fa fa-check"></span>is Special</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<div class="checkbox c-checkbox">
<label>
<input type="checkbox" ng-model="rec.isMultiple" ng-true-value = "YES" ng-false-value="NO">
<span class="fa fa-check"></span>Is Multiple</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button type="button" ng-click="add(rec)" class="btn btn-sm btn-primary">ADD</button>
</div>
</div>
</form>
This question already has an answer here:
Angular scope not affecting ng-show as expected
(1 answer)
Closed 7 years ago.
I have the following partial where some expression has
example : ng-show="'{{selectedtournoi.tournois_simple}}'==1"
On the first occurence it provides true evaluation, not on the second one.
I checked my html tags, they sound well formed.
I don't understand this behavior;
full code:
<div Class='' ng-controller="tournoisCtrl">
<div class="">
</div>
<!-- Liste des tournois -->
<div ng-show="showtournoislist">
<div ng-show="tournois.tournois.length" class="">
<ul id="tournois-list">
<li ng-repeat="tournoi in tournois.tournois track by $index">
<div class="tournois">
<div class='row'>
<span class='tournois_title'>{{tournoi.tournois_title}}</span>
</div>
<div class='row'>
<span class='tournois_dates'>Du {{tournoi.tournois_date_debut | date:'d-M-yyyy'}} au {{tournoi.tournois_date_fin | date:'d-M-yyyy'}}</span>
</div>
<div class='row'>
<span class='tournois_dates'> Limite d'inscription : {{tournoi.tournois_date_limite | date:'d-M-yyyy'}}</span>
</div>
<div class='row'>
<a ng-click="toggleshowtournois(tournoi.tournois_id)"><button class="btn btn-primary btn-xs">En savoir plus</button></a>
</div>
</div>
</li>
</ul>
</div>
</div>
<!-- Détail d'un tournoi -->
<div ng-show="!showtournoislist">
<ul class="tournois">
<div>
<span class='tournois_title'>{{selectedtournoi.tournois_title}}</span>
</div>
<div>
<span class='tournois_dates'>Du {{selectedtournoi.tournois_date_debut | date:'d-M-yyyy'}} au {{selectedtournoi.tournois_date_fin | date:'d-M-yyyy'}}</span>
</div>
<div>
<span class='tournois_dates'> Limite d'inscription : {{selectedtournoi.tournois_date_limite | date:'d-M-yyyy'}}</span>
</div>
<div>
<span class='tournois_dates'> Tournoi financé : {{selectedtournoi.tournois_decompte}}</span>
</div>
<div>
<span class='tournois_dates'> Description : {{selectedtournoi.tournois_description}}</span>
</div>
<div>
<a ng-click="showinscris=!showinscris"><button class='badge'>{{selectedinscris.length}} inscris</button></a>
</div>
<!-- Liste des inscrits-->
<div ng-show="showinscris">
<div ng-repeat="tinsc in selectedinscris" class="tournois_dates">
<span class="tournois_inscris_name">{{tinsc.fullname}}</span><br>
<span ng-show="'{{selectedtournoi.tournois_simple}}'==1">Simple ({{tinsc.inscriptions_simple_serie}})</span>
<br ng-show="'{{tinsc.inscriptions_double_partenaire}}'!=''"><span ng-show="'{{tinsc.inscriptions_double_partenaire}}'">Double ({{tinsc.inscriptions_double_serie}})</span>
<span ng-show="'{{tinsc.inscriptions_double_partenaire}}'!=''"> avec {{tinsc.inscriptions_double_partenaire}} / {{tinsc.inscriptions_double_partenaire_club}}</span>
<br ng-show="'{{tinsc.inscriptions_mixte_partenaire}}'!=''"><span ng-show="'{{tinsc.inscriptions_mixte_partenaire}}'">Mixte ({{tinsc.inscriptions_mixte_serie}})</span>
<span ng-show="'{{tinsc.inscriptions_mixte_partenaire}}'!=''">avec {{tinsc.inscriptions_mixte_partenaire}} / {{tinsc.inscriptions_mixte_partenaire_club}}</span>
</div>
</div>
<br>
<div ng-show="!logguedinscris">
<span ng-show="Loggued">
<span ng-show="!showLimite">
<a href ng-show="!showinscription" ng-click="showinscription=!showinscription"><button class="btn btn-primary btn-xs">Participer</button></a>
</span>
</span>
</div>
<div ng-show="!Loggued">
<span ng-show="!showLimite">Vous devez vous <a ui-sref="login">identifier</a> pour participer</span>
</div>
<br>
<!--Mon inscription-->
<div>
<form ng-submit="submitForm()" ng-show='!showLimite'>
<!-- Simple-->
<!-- participation -->
<div class="form-group" ng-show="'{{selectedtournoi.tournois_simple}}'==1">
<label>Simple</label>
<input type="checkbox" name="cbSimple" ng-click="showSi=!showSi" ng-checked="forminscris.inscriptions_simple==1" ng-model="forminscris.inscriptions_simple" >
<!-- Serie -->
<label ng-show="showSi">Serie</label>
<select ng-show="showSi" ng-options="item as item for item in selectedtournoi.tournois_xserie_simple track by item" ng-model="selectedSerieSimple"></select> </div>
<div class="form-group" ng-show="'{{selectedtournoi.tournois_double}}'==1">
<label>Double</label>
<input type="checkbox" name="cbDouble" ng-click="showDbl=!showDbl" ng-checked="forminscris.inscriptions_double==1" ng-model="forminscris.inscriptions_double">
<label ng-show="showDbl">Serie</label>
<select ng-show="showDbl" ng-options="item as item for item in selectedtournoi.tournois_xserie_double track by item" ng-model="selectedSerieDouble"></select>
<br ng-show="showDbl">
<label ng-show="showDbl">Partenaire</label><br ng-show="showDbl">
<label ng-show="showDbl">Bacly ? </label><input type="checkbox" ng-show="showDbl" name="BaclyDbl" ng-checked="showBaclyDbl==true" ng-click="showBaclyDbl=!showBaclyDbl"><br ng-show="showDbl">
<select ng-show="showBaclyDbl && showDbl" ng-model="selectedPartenaireDoubleBacly" ng-options="item.user_id as item.fullname for item in baclyusersdouble.users" class="selectuser"></select>
<input type="text" name="partenaireDouble" ng-show="!showBaclyDbl && showDbl" ng-model="forminscris.inscriptions_double_partenaire">
<br ng-show="showDbl">
<label ng-show="!showBaclyDbl && showDbl">Club :</label><br ng-show="showDbl">
<input type="text" ng-show="!showBaclyDbl && showDbl" name="clubPartenaireDouble" ng-model="forminscris.inscriptions_double_partenaire_club">
</div>
<div class="form-group" ng-show="'{{selectedtournoi.tournois_mixte}}'==1">
<label>Mixte</label>
<input type="checkbox" name="cbMixte" ng-click="showMx=!showMx" ng-checked="forminscris.inscriptions_mixte==1" ng-model="forminscris.inscriptions_mixte">
<!-- <p ng-show="form.userForm.name.$invalid && !form.userForm.name.$pristine" class="help-block">You name is required.</p>-->
<!-- Serie -->
<label ng-show="showMx">Serie</label>
<select ng-show="showMx" ng-options="item as item for item in selectedtournoi.tournois_xserie_mixte track by item" ng-model="selectedSerieMixte"></select>
<br ng-show="showMx">
<label ng-show="showMx">Partenaire</label><br ng-show="showMx">
<label ng-show="showMx">Bacly ? </label><input type="checkbox" name="BaclyMx" ng-checked="showBaclyMx==true" ng-click="showBaclyMx=!showBaclyMx" ng-show="showMx"><br ng-show="showMx">
<select ng-show="showBaclyMx && showMx" ng-model="selectedPartenaireMixteBacly" ng-options="item.user_id as item.fullname for item in baclyusersmixte.users" class="selectuser"></select>
<input type="text" ng-show="!showBaclyMx && showMx" name="partenaireMixte" ng-model="forminscris.inscriptions_mixte_partenaire">
<br ng-show="showMx">
<label ng-show="!showBaclyMx && showMx" >Club :</label><br ng-show="showMx">
<input type="text" ng-show="!showBaclyMx && showMx" name="clubPartenaireMixte" ng-model="forminscris.inscriptions_mixte_partenaire_club">
</div>
<div class="form-group">
<label>Commentaire</label>
<input type="text" name="commentaire" placeholder="" ng-model="forminscris.inscriptions_comment">
</div>
<br>
<div class=''>
<a href ng-click="insertinscription()"><button class="btn btn-primary btn-xs" ng-show="Loggued && !logguedinscris">M'inscrire</button></a>
<a href ng-click="showinscription=!showinscription"><button class="btn btn-info btn-xs" ng-show="!logguedinscris">Annuler</button></a>
<a href ng-click="updateinscription()"><button class="btn btn-primary btn-xs" ng-show="Loggued && logguedinscris" >Mettre à jour</button></a>
<a href ng-click="deleteinscription()"><button class="btn btn-info btn-xs" ng-show="Loggued && logguedinscris" >Me désinscrire</button></a>
</div>
</form>
</div>
</ul>
</div>
</div>
I don't think the interpolation is necessary inside the ng-show directive attribute.
You can use ng-show = " selectedtournoi.tournois_simple == 1 ".
Hope that helps!
I am using backbone to populate the table and then be able to edit the contents using modals implemented in bootstrap.
The table populates very well but on clicking edit on the modal, all field contain data of the first entry only
Here is the code,
<tbody>
<% users.each(function(user){ %>
<tr>
<td>
<%= user.get("first_name") %>
</td>
<td><%= user.get("last_name") %></td>
<td><%= user.get("gender") %></td>
<td >
24 years
</td>
<td >
<%= user.get("email") %>
</td>
<td class="hidden-480">
<%= user.get("phone_number")%>
</td>
<td class="hidden-480">
<%= user.get("role") %>
</td>
<td>
<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
<a href="#modal-form" role="button" class="blue" data-toggle="modal">
<i class="icon-pencil bigger-130" id="user_edit" ></i>
</a>
<a class="red" href="#">
<i class="icon-trash bigger-130" id="user_delete" ></i>
</a>
</div>
</td>
</tr>
<div id="modal-form" class="modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="blue bigger">Edit User</h4>
</div>
<div class="modal-body overflow-visible">
<div class="row">
<div class="col-xs-12">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> First Name </label>
<div class="col-sm-9">
<input type="text" id="user_first_name" value=<%= user.get("first_name")%> class="col-xs-10 col-sm-10" />
</div>
</div><br>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Last Name </label>
<div class="col-sm-9">
<input type="text" id="user_last_name" value=<%= user.get("last_name")%> class="col-xs-10 col-sm-10" />
</div>
</div> <br>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Date of Birth </label>
<div class="col-sm-9">
<input type="text" id="user_date_of_birth" value=<%= user.get("date_of_birth")%> class="col-xs-10 col-sm-10" />
</div>
</div><br>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Gender </label>
<div class="col-sm-9">
<select id="user_gender" class="col-xs-10 col-sm-10 ">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
</div><br>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> Phone Number </label>
<div class="col-sm-9">
<input type="text" id="user_phone_number" value=<%= user.get("phone_number")%> class="col-xs-10 col-sm-10" />
</div>
</div><br>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> E-mail Address </label>
<div class="col-sm-9">
<input type="text" id="user_email" value=<%= user.get("email")%> class="col-xs-10 col-sm-10" />
</div>
</div><br>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-2">
Password
</label>
<div class="col-sm-9">
<input id="user_password" class="col-xs-10 col-sm-10" type="password">
</div>
</div><br>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right" for="form-field-2">
Confirm Password
</label>
<div class="col-sm-9">
<input id="password_confirmation" class="col-xs-10 col-sm-10" type="password">
</div>
</div> <br>
<div class="clearfix form-actions">
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-info" type="button" id="user_submit">
<i class="icon-ok bigger-110"></i>
Submit
</button>
<button class="btn" type="reset">
<i class="icon-undo bigger-110"></i>
Reset
</button>
</div>
</div>
<div class="hr hr-24"></div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<% }); %>
</tbody>
In your loop you are assigning an ID to the modal and this is giving them all the same IDs. Maybe the bootstrap JS is only showing the first one that it finds which is why you see the same one every time. Maybe you if you appended the ID of the user or something unique to the ID of the modal this would work.
For Example:
<div id="modal-form" class="modal" tabindex="-1">
and
<a href="#modal-form" role="button" class="blue" data-toggle="modal">
could be changed to:
<div id="modal-form-<%= user.get('id') %>" class="modal" tabindex="-1">
and
<a href="#modal-form-<%= user.get('id') %>" role="button" class="blue" data-toggle="modal">