Problem: I am unable to clear the fields of the form completely.
Let me be more specific. When I go to the console, it appears that the previous entries are still present even though the reset button has been selected.
I have done the following in the form. I have a submit button and a reset button.
<div class="panel panel-default">
<div class="panel-body">
<form name="providerSearch" ng-submit="SearchProvider(searchParam);" novalidate role="form">
<div class="form-group"><input class="form-control" id="physiciansfirstname" ng-model="searchParam.FirstName" placeholder="First name:" type="text" /></div>
<div class="form-group"><input class="form-control" id="physicianslastname" ng-model="searchParam.LastName" placeholder="Last name:" type="text" /></div>
<!---<div class="form-group">
<select class="form-control" id="providerSpecialty" ng-model="searchParam.Specialty">
<option disabled="disabled" selected="selected" value="">Specialty</option>--->
<!---<option disabled="disabledvalue=""></option>---><!---<option>Family practice</option><option>General practice</option><option>Internal medicine</option><option>Pediatrics</option>
</select>--->
<div class="form-group">
<select class="form-control" id="providerSpecialty" ng-model="searchParam.Specialty">
<option selected="selected" value="">Specialty</option>
<!---<option value=""></option>--->
<cfoutput query="SpFind">
<option value=#ProviderSpecialty#>#ProviderSpecialty#</option>
</cfoutput>
</select>
</div>
<div class="form-group">
<select class="form-control" id="city" ng-model="searchParam.City">
<option selected="selected" value="">City</option>
<!---<option value=""></option>--->
<cfoutput query="cityFind">
<option value=#city#>#city#</option>
<!---<option ng-selected="{{searchParam.City==#city#?true:false}} value=#city#>#city#</option>--->
</cfoutput>
</select>
<!---<select class="form-control" id="city" ng-model="searchParam.City"><option disabled="disabled" selected="selected" value="">City</option><option ng-repeat="c in Cities" value="{{c.City}}">{{c.City}}</option> </select>--->
</div>
<div class="row">
<!---<div class="col-xs-6 no-right-padding paddingLanguage">
<div class="form-group widthLanguage">
<select id="language" name="language" class="form-control" ng-model="searchParam.Language">
<option disabled="disabled" selected="selected" value="">Language</option>
<!---<option value=""></option>--->
<cfoutput query="Languages">
<option value=#Language#>#Language#</option>
</cfoutput>
</select>
<!---<select name="language" class="form-control widthLanguage" id="language" ng-model="searchParam.Language">
<option disabled="disabled" selected="selected" value="">Language</option>
<option ng-repeat="l in Languages">{{l.Lang}}</option>
</select>--->
</div>
</div>--->
<div class="col-xs-6 no-left-padding">
<div class="form-group"><select class="form-control" id="gender" name="gender" ng-model="searchParam.Gender">
<option selected="selected" value="">Gender</option>
<!---<option value=""></option>--->
<option>Male</option><option>Female</option> </select></div>
</div>
</div>
<hr class="hrDoctor" />
<div style="margin-top:-10px; margin-bottom:10px; text-align:center; font-size:8pt! important">* or Search by Zip code radius *</div>
<div class="row">
<div class="col-xs-7 no-right-padding">
<div class="form-group">
<div class="input-group">
<select class="form-control" id="miles" name="distance" ng-model="searchParam.Distance">
<!---<option selected="selected" value="" disabled="disabled">Miles</option>--->
<option selected="disabled" value=""></option>
<option value={{v.value}} ng-repeat="(k , v) in miles track by $index">{{v.value}}</option>
<!---<option selected="disabled" value=""></option>
<option selected="selected" value="5">5</option>
<option selected="selected" value="10">10</option>
<option selected="selected" value="15">15</option>
<option selected="selected" value="20">20</option>--->
</select>
<div class="input-group-addon">mi</div>
</div>
</div>
</div>
<div class="col-xs-5 no-left-padding widthZip">
<div class="form-group">
<input allow-pattern="[\d\W]" class="form-control" id="zip" maxlength="5" ng-model="searchParam.Zip" placeholder="Zip code" type="text" />
</div>
</div>
</div>
<div class="form-group">
<input class="btn btn-warning btn-block" onclick="return checkTextField(); overlayDisplayButton();" ng-click="gotoElement('SearchResultsAnchor');" type="submit" value="Search" />
<div style="margin-top:10pt"><button type="reset" class="btn btn-info btn-block" ng-click="reset()">Reset</button></div>
</div>
</form>
</div>
Here is the following script to reset the form:
$scope.reset = function(form) {
form.$setPristine();
form.$setUntouched();
};
What am I missing to reset the form completely?
This should be your reset function:
$scope.reset = function() {
$scope.searchParam = {};
$scope.providerSearch.$setPristine();
$scope.providerSearch.$setUntouched();
};
where providerSearch is a form name.
Related
I have problem with set values in localStorage. I use AngularJS and Electron. When I update refreshTime, values for errors and opacity are set to null. Why?
$scope.storageLang = localStorage.getItem("language");
$scope.storageMonitors = localStorage.getItem("monitors");
$scope.storageAlarm = localStorage.getItem("alarm");
$scope.storageErrors = localStorage.getItem("errors");
$scope.storageDomain = localStorage.getItem("domain");
$scope.storageOpacity = localStorage.getItem("opacity");
$scope.refreshTime = localStorage.getItem("refreshTime");
$scope.submit = function($event) {
$event.preventDefault();
localStorage.setItem("domain", $scope.storageDomain);
localStorage.setItem("language", $scope.storageLang);
localStorage.setItem("monitors", $scope.storageMonitors);
localStorage.setItem("alarm", $scope.storageAlarm);
localStorage.setItem("errors", $scope.storageErrors);
localStorage.setItem("opacity", $scope.storageOpacity);
localStorage.setItem("refreshTime", $scope.refreshTime);
};
In HTML all my inputs has ng-model="storageLang" etc...
<form ng-submit="submit($event)" style="overflow:hidden">
<div class="field">
<label>{{ lang.domain }}</label>
<input type="text" ng-model="storageDomain" value="{{ storageDomain }}">
</div>
<div class="field">
<label>{{ lang.language }}</label>
<select ng-model="storageLang">
<option value="de" ng-selected="storageLang=='de'">Deutsch</option>
<option value="en" ng-selected="storageLang=='en'">English</option>
<option value="pl" ng-selected="storageLang=='pl'">Polski</option>
</select>
</div>
<div class="field">
<label>{{ lang.monitors }}</label>
<select ng-model="storageMonitors">
<option value="1" ng-selected="storageMonitors==1">1</option>
<option value="2" ng-selected="storageMonitors==2">2</option>
<option value="3" ng-selected="storageMonitors==3">3</option>
<option value="4" ng-selected="storageMonitors==4">4</option>
</select>
</div>
<div class="field">
<label>{{ lang.alarm }}</label>
<select ng-model="storageAlarm">
<option value="1" ng-selected="storageAlarm=='1'">{{ lang.yes }}</option>
<option value="0" ng-selected="storageAlarm=='0'">{{ lang.no }}</option>
</select>
</div>
<div class="field">
<label>{{ lang.errorslimit }}</label>
<input type="number" ng-model="storageErrors" value="{{ storageErrors }}" min="10">
</div>
<div class="field">
<label>{{ lang.opacity }}</label>
<input type="number" ng-model="storageOpacity" value="{{ storageOpacity }}" min="25" step="5">
</div>
<div class="field">
<label>{{ lang.refreshTime }}</label>
<input type="number" ng-model="refreshTime" value="{{ refreshTime }}" min="10" step="1">
</div>
<button class="button expanded neutral">{{ lang.save }}</button>
</form>
Problem was that I use value="{{ storageOpacity }}" and I just need to use ng-model. Beside this I need to use parseInt for some integer values...
localStorage can only handle strings so setting integers is going to cause issues.
Use a library like localForage which has the same API but will use IndexedDb in Electron and handles other data types.
I was trying to disable the submit button, when the fields are empty. But its not working. Don't know why its not working. Saw many blogs, but could't figure whats the issue.
<form name="createForm">
<div class="form-group col-md-6">
<label for="createName">Student</label>
<select class="form-control" name="student" id="createName" ng-
model="createStudent.studentId" ng-options="item.name for item in
allStudent" required>
<option value="" selected disabled>Select</option>
</select>
</div>
<div class="form-group col-md-6">
<label for="createClass">Class</label>
<select class="form-control" name="class" id="createClass" ng-
model="createStudent.classId" ng-options="item.number for item in
allClass" required>
<option value="" selected disabled>Select</option>
</select>
</div>
</div>
<div class="form-group col-md-6 text-md-center">
<label for="createCategory">Type of Category</label>
<select class="form-control" name="category" id="createCategory"
ng-model="createStudent.type" ng-options="item.category_type for
item in allcategoriestypes" required>
<option value="" selected disabled>Select</option>
</select>
</div>
</div>
<div class="row align-items-end justify-content-center">
<div class="form-group col-md-6 text-md-center">
<label for="createTeacherName">Teacher Name</label>
<input type="text" class="form-control" name="teacher"
id="createTeacherName" ng-model="createStudent.name"
placeholder="Enter Teacher Name" required>
</div>
</div>
</div>
<div class="text-center pt-1">
<button type="submit" class="btn btn-info px-5" ng-
click="create(createStudent)" ng-
disabled="createForm.$invalid">Save</button>
</div>
</form>
it is working fine.it disable the submit button, when the fields are empty.
<!DOCTYPE html>
<html>
<body>
<form name="createForm">
<div class="form-group col-md-6">
<label for="createName">Student</label>
<select class="form-control" name="student" id="createName" ng-
model="createStudent.studentId" ng-options="item.name for item in
allStudent" required>
<option value="" selected disabled>Select</option>
</select>
</div>
<div class="form-group col-md-6">
<label for="createClass">Class</label>
<select class="form-control" name="class" id="createClass" ng-
model="createStudent.classId" ng-options="item.number for item in
allClass" required>
<option value="" selected disabled>Select</option>
</select>
</div>
</div>
<div class="form-group col-md-6 text-md-center">
<label for="createCategory">Type of Category</label>
<select class="form-control" name="category" id="createCategory"
ng-model="createStudent.type" ng-options="item.category_type for
item in allcategoriestypes" required>
<option value="" selected disabled>Select</option>
</select>
</div>
</div>
<div class="row align-items-end justify-content-center">
<div class="form-group col-md-6 text-md-center">
<label for="createTeacherName">Teacher Name</label>
<input type="text" class="form-control" name="teacher"
id="createTeacherName" ng-model="createStudent.name"
placeholder="Enter Teacher Name" required>
</div>
</div>
</div>
<div class="text-center pt-1">
<button type="submit" class="btn btn-info px-5" ng-
click="create(createStudent)" ng-
disabled="createForm.$invalid">Save</button>
</div>
</form>
</body>
</html>
Please find the working plunker for your code :
http://plnkr.co/edit/H1LOahFNWRXYHWTVmrcW?p=preview
<form name="createForm">
<div class="form-group col-md-6">
<label for="createName">Student</label>
<select class="form-control" name="student" id="createName" ng-
model="createStudent.studentId" required>
<option value="studentValue">Student Name</option>
</select>
</div><br/>
<div class="form-group col-md-6">
<label for="createClass">Class</label>
<select class="form-control" name="class" id="createClass" ng-
model="createStudent.classId" required>
<option value="classValue">Class</option>
</select>
</div><br/>
<div class="form-group col-md-6 text-md-center">
<label for="createCategory">Type of Category</label>
<select class="form-control" name="category" id="createCategory"
ng-model="createStudent.type" required>
<option value="typeValue">Category</option>
</select>
</div><br/>
<div class="row align-items-end justify-content-center">
<div class="form-group col-md-6 text-md-center">
<label for="createTeacherName">Teacher Name</label>
<input type="text" class="form-control" name="teacher"
id="createTeacherName" ng-model="createStudent.name"
placeholder="Enter Teacher Name" required>
</div>
</div><br/>
<div class="text-center pt-1">
<label>Value returned for $invalid :: {{createForm.$invalid}}</label><br/><br/>
<button type="submit" class="btn btn-info px-5" ng-click="create(createStudent)" ng-disabled="createForm.$invalid">Save</button>
</div>
</form>
Make sure all your tags are properly closed and none of your fields are empty.
In my application I have 3 date formats PST, CST, and EST. When converting to IST the resulting date is 1 day earlier. Any suggestions?
#nalyd88 my html is
Select Date For Interview*
<div class="col-md-2">
<p>
<label>Start Time<label class="text-red" style="margin-bottom: 0px;">*</label></label>
<select class="form-control " ng-model="resume.interviewAvailability[0].from" required="required" ng-change="setEndTime(0);" style="margin-bottom: 23px;">
<option ng-repeat="time in startDate">{{time}}</option>
</select>
<select class="form-control " ng-model="resume.interviewAvailability[1].from" required="required" ng-change="setEndTime(1);" style="margin-bottom: 23px;">
<option ng-repeat="time in startDate">{{time}}</option>
</select>
<select class="form-control " ng-model="resume.interviewAvailability[2].from" required="required" ng-change="setEndTime(2);" style="margin-bottom: 23px;">
<option ng-repeat="time in startDate">{{time}}</option>
</select>
</p>
</div>
<div class="col-md-2">
<p>
<label>End Time<label class="text-red" style="margin-bottom: 0px;">*</label></label>
<select class="form-control " ng-model="resume.interviewAvailability[0].to" ng-change="checkInvalidEndTime(0);" ng-disabled="resume.interviewAvailability[0].invalid" required="required" style="margin-bottom: 23px;">
<option ng-repeat="time in endDate1[0]">{{time}}</option>
</select>
<select class="form-control" ng-model="resume.interviewAvailability[1].to" ng-change="checkInvalidEndTime(1);" ng-disabled="resume.interviewAvailability[1].invalid" required="required" style="margin-bottom: 23px;">
<option ng-repeat="time in endDate1[1]">{{time}}</option>
</select>
<select class="form-control" ng-model="resume.interviewAvailability[2].to" ng-change="checkInvalidEndTime(2);" ng-disabled="resume.interviewAvailability[2].invalid" required="required" style="margin-bottom: 23px;">
<option ng-repeat="time in endDate1[2]">{{time}}</option>
</select>
</p>
</div>
<div class="col-md-2">
<p>
<label >Time Zone<label class="text-red" style="margin-bottom: 0px;">*</label></label>
<select class="form-control" ng-model="resume.interviewAvailability[0].timeZone" required="required" style="margin-bottom: 23px;">
<option ng-repeat="timeZone in timeZones">{{timeZone}}</option>
</select>
<select class="form-control" ng-model="resume.interviewAvailability[1].timeZone" required="required" style="margin-bottom: 23px;">
<option ng-repeat="timeZone in timeZones">{{timeZone}}</option>
</select>
<select class="form-control" ng-model="resume.interviewAvailability[2].timeZone" required="required" style="margin-bottom: 23px;">
<option ng-repeat="timeZone in timeZones">{{timeZone}}</option>
</select>
</p>
</div>
</div>
<div class="row" style="margin-left: 0px;margin-right: 0px;margin-bottom: 8px;margin-top: 8px;">
<div class="col-md-3">
<h3 class="text-left text-primary">
Attachments
</h3>
</div>
and my controller is
(function(){
function applyJobController($scope,$state,openingsFactory,openingsService,$loading){
var today=new Date();
$scope.error="";
$scope.dateOptions={
"first":{
minDate: today
},
"second":{
minDate:today
},
"third":{
minDate: today
}
};
$scope.disabled = function(date, mode) {
return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
};
$scope.timeZones=["PST","CST","EST"];
$scope.startDate=["8:30 AM","9:00 AM","9:30 AM","10:00 AM","10:30 AM","11:00 AM","11:30 AM","12:00 PM","12:30 PM","01:00 PM","01:30 PM","02:00 PM","02:30 PM","03:00 PM","03:30 PM","04:00 PM","04:30 PM","05:00 PM","05:30 PM","06:00 PM","06:30 PM","07:00 PM"];
$scope.endDate=["9:30 AM","10:00 AM","10:30 AM","11:00 AM","11:30 AM","12:00 PM","12:30 PM","01:00 PM","01:30 PM","02:00 PM","02:30 PM","03:00 PM","03:30 PM","04:00 PM","04:30 PM","05:00 PM","05:30 PM","06:00 PM","06:30 PM","07:00 PM","07:30 PM","08:00 PM"];
$scope.resume={
"sections":[],
"interviewAvailability":[
{"from":$scope.startDate[0],
"to":$scope.endDate[0],
"timeZone":$scope.timeZones[0],
"invalid":false
},
{"from":$scope.startDate[0],
"to":$scope.endDate[0],
"timeZone":$scope.timeZones[0],
"invalid":false
},
{"from":$scope.startDate[0],
"to":$scope.endDate[0],
"timeZone":$scope.timeZones[0],
"invalid":false
}],
"attachment":"",
"attachmentName":"",
"notes":""
};
$scope.setEndTime=function(index){
$scope.resume.interviewAvailability[index].invalid=true;
if($scope.resume.interviewAvailability[index].from!=="Start Time"){
$scope.resume.interviewAvailability[index].invalid=false;
$scope.endDate1[index]=angular.copy($scope.endDate).splice($scope.startDate.indexOf($scope.resume.interviewAvailability[index].from));
$scope.resume.interviewAvailability[index].to=$scope.endDate1[index][0];
}
};
$scope.checkInvalidEndTime=function(index){
if($scope.resume.interviewAvailability[index].to==="End Time"){
$scope.resume.interviewAvailability[index].invalid=true;
}
};
};
applyJobController.$inject=['$scope','$state','openingsFactory','openingsService','$loading'];
angular.module('vResume.openings').controller("applyJobController",applyJobController);
})();
I am going to answer this with a generic suggestion. Moment is a tool to handle dates really well.
Note: in your time zone midnight (if you don't specify a time) may just be the day before in another time zone. It may be something like this that is causing you issues.
I have following code:
<form name="reviewForm_{{$index}}" ng-controller="reviewController as reviewCtrl" ng-submit="reviewCtrl.addReview(product)" novalidate>
<blockquote class="newReview">
<b>Stars {{reviewCtrl.review.stars}}</b>
<p>{{reviewCtrl.review.comment}}</p>
<cite>{{reviewCtrl.review.author}}</cite>
</blockquote>
<select class="form-control" ng-model="reviewCtrl.review.stars">
<option value="1">1 star</option>
<option value="1">2 stars</option>
<option value="1">3 stars</option>
<option value="1">4 stars</option>
<option value="1">5 stars</option>
</select><br />
<textarea ng-model="reviewCtrl.review.comment" required></textarea>
<label>by:</label>
<input type="text" ng-model="reviewCtrl.review.author" required /><br />
<div>reviewForm is {{reviewForm_$index.$valid}}</div>
<input class="btn btn-primary btn-large" type="submit" value="Submit" />
</form>
The Form above lies within a ng-repeat and has the name reviewForm_$index.
That works fine. So it will give reviewForm_0, reviewForm_1 and so on.
Now I would like to check if the form is valid with {{reviewForm_$index_$valid}}.
For some reason it doesn't show anything.
Do I have the wrong syntax?
Actually you are trying to access a property that does not exists since reviewform_$index will be treated as a form name not a variable. So change your code to something like this:
<div>reviewForm is {{reviewCtrl['reviewForm_' + $index].$valid}}</div>
That will work!!
Ok, I got it to work thanks to #klode.
Here my solution:
<form name="reviewForm" ng-controller="reviewController as reviewCtrl" ng-submit="reviewCtrl.addReview(product)" novalidate>
<blockquote class="newReview">
<b>Stars {{reviewCtrl.review.stars}}</b>
<p>{{reviewCtrl.review.comment}}</p>
<cite>{{reviewCtrl.review.author}}</cite>
</blockquote>
<select class="form-control" ng-model="reviewCtrl.review.stars">
<option value="1">1 star</option>
<option value="2">2 stars</option>
<option value="3">3 stars</option>
<option value="4">4 stars</option>
<option value="5">5 stars</option>
</select><br />
<textarea ng-model="reviewCtrl.review.comment" required></textarea>
<label>by:</label>
<input type="text" ng-model="reviewCtrl.review.author" required /><br />
<div>reviewForm is {{reviewForm.$valid}}</div>
<input class="btn btn-primary btn-large" type="submit" value="Submit" />
</form>
As explained by Klode can I leave the form name without the $index trailer and address the form's $valid property each loop via it's name just so: reviewForm.$valid
I have a Angular modal that has Angular-UI tabs. The input fields outside the tabs POST fine, Input fields inside the tabs are not. However I use the same modal for PUT and that modal updates the DB with new data. Is this a scope issue?
<fieldset>
<div class="col-xs-12">
#*<label style="">Hide: </label>
<input style="" ng-model="currentItem.JobHidden" type="checkbox">*#
<div class="inline-fields">
<h4 style="margin-left:24px">Job Info Customer Info</h4>
<label style="margin-left:23px">Number:</label>
<input style="width:100px" ng-model="JobNumber" type="text">
<label style="margin-left:115px">Customer:</label>
<input style="width:150px" type="text" ng-model="CustomerName"
typeahead="customer.CustomerName for customer in customerArray | filter:$viewValue"
placeholder="Enter Customer" typeahead-on-select="selectNewCustomer($item)">
</div>
<div class="inline-fields">
<label style="margin-left:33px">Status:</label>
<select style="width: 100px" ng-model="JobStatus">
<option disabled>Select</option>
<option value="Active">Active</option>
<option value="InActive">InActive</option>
<option value="Complete">Complete</option>
</select>
<label style="margin-left:125px">Address:</label>
<input style="width:200px" ng-model="CustomerAddress" type="text">
</div>
<div class="inline-fields">
<label style="margin-left:38px">Name:</label>
<input style="width:150px" ng-model="JobName" type="text">
<label style="margin-left:104px">City:</label>
<input style="width: 66px" ng-model="CustomerCity" type="text">
<label>St:</label>
<input style="width: 30px" ng-model="CustomerState" type="text">
<label>Zip:</label>
<input style="width: 44px" ng-model="CustomerZipcode" type="text">
</div>
<div class="inline-fields">
<label style="margin-left:20px">Address:</label>
<input style="width:185px" ng-model="JobAddress" type="text">
<label style="margin-left:78px">Ph:</label>
<input style="width: 100px; " ng-model="CustomerPhoneNumber" type="text">
<label style="margin-left:0px">Fax:</label>
<input style="width: 89px" ng-model="CustomerFaxNumber" type="text">
</div>
<div class="inline-fields">
<label style="margin-left:49px">City:</label>
<input style="width:66px" ng-model="JobCity" type="text">
<label>St:</label>
<input style="width:30px" ng-model="JobState" type="text">
<label>Zip:</label>
<input style="width:44px" ng-model="JobZipcode" type="text">
</div>
<div class="inline-fields">
<label style="margin-left:58px">Ph:</label>
<input style="width:100px" ng-model="JobPhoneNumber" type="text">
<label>Fax:</label>
<input style="width:89px" ng-model="JobFaxNumber" type="text">
</div>
<div class="inline-fields">
<label style="margin-left:55px">PM:</label>
<select style="width:138px" ng-options="employee.EmployeeFirstName + ' ' + employee.EmployeeLastName as employee.EmployeeFirstName + ' ' + employee.EmployeeLastName for employee in employeeArray | filter:{EmployeeIsPM : true}" ng-model="JobTESPM">
<option value="" disabled>Select</option>
</select>
</div>
</div>
</fieldset><br />
<!--Cover Content-->
<tabset>
<tab heading="Contract">
<div class="col-xs-12" style="margin-top:10px">
<div class="inline-fields">
<label style="margin-left:13px">Original Contract:</label>
<input style="width:115px" ng-model="JobOriginalContract" type="text" format="number">
<label style="margin-left:57px">Geo Area:</label>
<select style="width: 115px" ng-model="JobGeoArea">
<option disabled>Select</option>
<option value="JobGeoArea-1">JobGeoArea-1</option>
<option value="JobGeoArea-2">JobGeoArea-2</option>
</select>
</div>
<div class="inline-fields">
<label style="margin-left:69px">Total CO:</label>
<input style="width:115px" ng-model="JobTotalCO" type="text" format="number">
<label style="margin-left:82px">Job Class:</label>
<select style="width: 115px; " ng-model="JobClass">
<option disabled>Select</option>
<option value="JobClass-1">JobClass-1</option>
<option value="JobClass-2">JobClass-2</option>
</select>
</div>
<div class="inline-fields">
<label style="margin-left:11px">Revised Contract:</label>
<input style="width:115px" ng-model="JobRevisedContract" type="text" format="number">
<label style="margin-left:55px">Min Wage:</label>
<select style="width:90px" ng-model="JobMinWage">
<option disabled>Select</option>
<option value="1000">$1000</option>
<option value="2000">$2000</option>
</select>
<label style="margin-left:0px">Job Type:</label>
<select style="width: 90px" ng-model="JobType">
<option disabled>Select</option>
<option value="JobType-1">JobType</option>
<option value="JobType-2">JobType</option>
</select>
</div>
<div class="inline-fields">
<label style="margin-left:59px">Retainage:</label>
<select style="width:115px" ng-model="JobRetainage">
<option disabled>Select</option>
<option value="JobRetainage-1">JobRetainage-1</option>
<option value="JobRetainage-2">JobRetainage-2</option>
<option value="JobRetainage-3">JobRetainage-3</option>
</select>
<label style="margin-left:42px">Tax Exempt:</label>
<select style="width: 115px" ng-model="JobTaxExempt">
<option disabled>Select</option>
<option value="true">True</option>
<option value="false">False</option>
</select>
</div>
<div class="inline-fields">
<label style="margin-left:21px">Original Budget:</label>
<input style="width:115px" ng-model="JobOriginalBudget" type="text" format="number">
<label style="margin-left:39px">Ins Program:</label>
<select style="width: 115px" ng-model="JobInsProgram">
<option disabled>Select</option>
<option value="JobInsProgram-1">JobInsProgram-1</option>
<option value="JobInsProgram-2">JobInsProgram-2</option>
<option value="JobInsProgram-3">JobInsProgram-3</option>
</select>
</div>
</div><!--End col-xs-12-->
</tab><!--End Contract Tab-->
<tab heading="Contacts">Contacts go here</tab>
<tab heading="Document Distribution">Document Distribution go here</tab>
</tabset><!--End Tab Content-->
<div class="col-xs-12">
<input style="margin-left:345px;width:70px;margin-right:20px;margin-top:25px" ng-click="printNewJobModal(currentItem)" type="button" value="Print" go-click="#" />
<input style="margin-right: 20px; width: 70px; margin-top: 25px" type="submit" value="Save" go-click="#" />
<input style="width: 70px; margin-top: 25px" type="button" data-dismiss="modal" value="Exit" go-click="#" />
</div>
//New Job Modal
$scope.NewJobModal = function () {
$ekathuwa.modal({
id: "NewJobModal", contentStyle: "width:800px;heigth:400px",
scope: $scope,
templateURL: "ModalNewJob"
});
}
//Post New Job
$scope.submitJob = function () {
var data = {
JobId: $scope.JobId,
JobNumber: $scope.JobNumber,
JobName: $scope.JobName,
JobDescription: $scope.JobDescription,
JobOriginalContract: $scope.JobOriginalContract,
JobBillingDate: $scope.JobBillingDate,
JobTotalCO: $scope.JobTotalCO,
JobRevisedContract: $scope.JobRevisedContract,
JobOriginalBudget: $scope.JobOriginalBudget,
JobBillingForm: $scope.JobBillingForm,
JobTESPM: $scope.JobTESPM,
JobTESSuperintendent: $scope.JobTESSuperintendent,
JobStatus: $scope.JobStatus,
JobMoreShit: $scope.JobMoreShit,
JobHidden: $scope.JobHidden,
JobTaxExempt: $scope.JobTaxExempt,
JobCertPayroll: $scope.JobCertPayroll,
JobCost: $scope.JobCost,
JobRemainingBudget: $scope.JobRemainingBudget,
JobProfit: $scope.JobProfit,
JobPercentage: $scope.JobPercentage,
JobTotalBilled: $scope.JobTotalBilled,
JobBalanceToBill: $scope.JobBalanceToBill,
JobBalanceDue: $scope.JobBalanceDue,
JobAddress: $scope.JobAddress,
JobCity: $scope.JobCity,
JobState: $scope.JobState,
JobZipcode: $scope.JobZipcode,
JobCounty: $scope.JobCounty,
JobPhoneNumber: $scope.JobPhoneNumber,
JobFaxNumber: $scope.JobFaxNumber,
JobGeoArea: $scope.JobGeoArea,
JobClass: $scope.JobClass,
JobType: $scope.JobType,
JobMinWage: $scope.JobMinWage,
JobInsProgram: $scope.JobInsProgram,
CustomerName: $scope.CustomerName,
CustomerPhoneNumber: $scope.CustomerPhoneNumber,
CustomerFaxNumber: $scope.CustomerFaxNumber,
CustomerAddress: $scope.CustomerAddress,
CustomerCity: $scope.CustomerCity,
CustomerState: $scope.CustomerState,
CustomerZipcode: $scope.CustomerZipcode,
CustomerWebsite: $scope.CustomerWebsite,
CustomerOtherShit: $scope.CustomerOtherShit,
CustomerHidden: $scope.CustomerHidden,
CustomerPM: $scope.CustomerPM,
CustomerAdmin: $scope.CustomerAdmin,
CustomerAccountant: $scope.CustomerAccountant,
CustomerSuperintendent: $scope.CustomerSuperintendent
}
$http.post('/api/apiJob/PostNewJob', data).success(function (data, status, headers) {
console.log(data); window.top.location.reload();
});
Updated Controller
//Post New Job
$scope.submitJob = function () {
var data = {
JobId: $scope.JobId,
JobNumber: $scope.JobNumber,
JobName: $scope.JobName,
JobDescription: $scope.JobDescription,
JobOriginalContract: $scope.JobOriginalContract.Value,
JobBillingDate: $scope.JobBillingDate,
JobTotalCO: $scope.JobTotalCO.Value,
JobRevisedContract: $scope.JobRevisedContract.Value,
JobOriginalBudget: $scope.JobOriginalBudget.Value,
JobBillingForm: $scope.JobBillingForm,
JobTESPM: $scope.JobTESPM,
JobTESSuperintendent: $scope.JobTESSuperintendent,
JobStatus: $scope.JobStatus,
JobMoreShit: $scope.JobMoreShit,
JobHidden: $scope.JobHidden,
JobTaxExempt: $scope.JobTaxExempt.Value,
JobCertPayroll: $scope.JobCertPayroll,
JobCost: $scope.JobCost,
JobRemainingBudget: $scope.JobRemainingBudget,
JobProfit: $scope.JobProfit,
JobPercentage: $scope.JobPercentage,
JobTotalBilled: $scope.JobTotalBilled,
JobBalanceToBill: $scope.JobBalanceToBill,
JobBalanceDue: $scope.JobBalanceDue,
JobAddress: $scope.JobAddress,
JobCity: $scope.JobCity,
JobState: $scope.JobState,
JobZipcode: $scope.JobZipcode,
JobCounty: $scope.JobCounty,
JobPhoneNumber: $scope.JobPhoneNumber,
JobFaxNumber: $scope.JobFaxNumber,
JobGeoArea: $scope.JobGeoArea.Value,
JobClass: $scope.JobClass.Value,
JobType: $scope.JobType.Value,
JobMinWage: $scope.JobMinWage.Value,
JobInsProgram: $scope.JobInsProgram.Value,
CustomerName: $scope.CustomerName,
CustomerPhoneNumber: $scope.CustomerPhoneNumber,
CustomerFaxNumber: $scope.CustomerFaxNumber,
CustomerAddress: $scope.CustomerAddress,
CustomerCity: $scope.CustomerCity,
CustomerState: $scope.CustomerState,
CustomerZipcode: $scope.CustomerZipcode,
CustomerWebsite: $scope.CustomerWebsite,
CustomerOtherShit: $scope.CustomerOtherShit,
CustomerHidden: $scope.CustomerHidden,
CustomerPM: $scope.CustomerPM,
CustomerAdmin: $scope.CustomerAdmin,
CustomerAccountant: $scope.CustomerAccountant,
CustomerSuperintendent: $scope.CustomerSuperintendent
}
$http.post('/api/apiJob/PostNewJob', data).success(function (data, status, headers) {
console.log(data); window.top.location.reload();
});
};
Updated View
<tab heading="Contract">
<div class="col-xs-12" style="margin-top:10px">
<div class="inline-fields">
<label style="margin-left:13px">Original Contract:</label>
<input style="width:115px" ng-model="JobOriginalContract.Value" type="text" format="number">
<label style="margin-left:57px">Geo Area:</label>
<select style="width: 115px" ng-model="JobGeoArea.Value">
<option disabled>Select</option>
<option value="JobGeoArea-1">JobGeoArea-1</option>
<option value="JobGeoArea-2">JobGeoArea-2</option>
</select>
</div>
<div class="inline-fields">
<label style="margin-left:69px">Total CO:</label>
<input style="width:115px" ng-model="JobTotalCO.Value" type="text" format="number">
<label style="margin-left:82px">Job Class:</label>
<select style="width: 115px; " ng-model="JobClass.Value">
<option disabled>Select</option>
<option value="JobClass-1">JobClass-1</option>
<option value="JobClass-2">JobClass-2</option>
</select>
</div>
<div class="inline-fields">
<label style="margin-left:11px">Revised Contract:</label>
<input style="width:115px" ng-model="JobRevisedContract.Value" type="text" format="number">
<label style="margin-left:55px">Min Wage:</label>
<select style="width:90px" ng-model="JobMinWage.Value">
<option disabled>Select</option>
<option value="1000">$1000</option>
<option value="2000">$2000</option>
</select>
<label style="margin-left:0px">Job Type:</label>
<select style="width: 90px" ng-model="JobType.Value">
<option disabled>Select</option>
<option value="JobType-1">JobType</option>
<option value="JobType-2">JobType</option>
</select>
</div>
<div class="inline-fields">
<label style="margin-left:59px">Retainage:</label>
<select style="width:115px" ng-model="JobRetainage.Value">
<option disabled>Select</option>
<option value="JobRetainage-1">JobRetainage-1</option>
<option value="JobRetainage-2">JobRetainage-2</option>
<option value="JobRetainage-3">JobRetainage-3</option>
</select>
<label style="margin-left:42px">Tax Exempt:</label>
<select style="width: 115px" ng-model="JobTaxExempt.Value">
<option disabled>Select</option>
<option value="true">True</option>
<option value="false">False</option>
</select>
</div>
<div class="inline-fields">
<label style="margin-left:21px">Original Budget:</label>
<input style="width:115px" ng-model="JobOriginalBudget.Value" type="text" format="number">
<label style="margin-left:39px">Ins Program:</label>
<select style="width: 115px" ng-model="JobInsProgram.Value">
<option disabled>Select</option>
<option value="JobInsProgram-1">JobInsProgram-1</option>
<option value="JobInsProgram-2">JobInsProgram-2</option>
<option value="JobInsProgram-3">JobInsProgram-3</option>
</select>
</div>
</div><!--End col-xs-12-->
</tab><!--End Contract Tab-->
};