I'm using angular UI buttons to make users select search criteria when user select buttons Patient or id it will show searchByText div if select date it will hide searchByText and show SearchBydateRange. my problem my is the angular show and hide is not working. and I use this codepen as example
http://codepen.io/SusanneLundblad/pen/iBhoJ
<div class="panel-body">
<form role="form">
<div class="col-md-7">
<div id="searchByText" class="form-group form-group-search" ng-hide=" searchOption == 'date'">
<label class="sr-only" for="search">Enter Search</label>
<input type="text" class="form-control" id="search" placeholder="Enter {{searchOption}} ..." data-ng-model="searchText">
</div>
<div id="SearchBydateRange" class="form-group form-group-search col-md-4" data-ng-show=" searchOption == 'date' ">
<label class=" sr-only" for="search">
Enter Search
</label>
<input type="text" class="form-control col-md-2" id="search" placeholder="From Date" data-ng-model="fromDate">
<input type="text" class="form-control col-md-2" id="search" placeholder="To Date" data-ng-model="toDate">
</div>
</div>
<div class="col-md-4 text-center">
<div class="btn-group btn-group-sm" data-ng-hide="userIsManager">
<label class="btn btn-searchsel" ng-model="searchOption" btn-radio="'patient'">Patient</label>
<label class="btn btn-searchsel" ng-model="searchOption" btn-radio="'id'">ID</label>
<label class="btn btn-searchsel" ng-model="searchOption" btn-radio="'Date'" va>Date</label>
</div>
</div>
<div class="col-md-1">
<button type="submit" class="btn btn-sm btn-info btn-search full-width" data-ng-click="doSearch()">Search</button>
</div>
</form>
</div>
Change the button part to this: (label or radio does not matter, but the important part is ng-click)
<div class="col-md-4 text-center">
<div class="btn-group btn-group-sm" data-ng-hide="userIsManager">
<input type="radio" ng-model="searchOption" value="patient" ng-click="searchOption = 'patient'">Patient</label>
<input type="radio" ng-model="searchOption" value="id" ng-click="searchOption = 'id'">ID</label>
<input type="radio" ng-model="searchOption" value="Date" ng-click="searchOption = 'date'">Date</label>
</div>
</div>
Then for your search div's:
<div class="col-md-7">
<div id="searchByText" class="form-group form-group-search" ng-hide=" searchOption == 'date'">
<label class="sr-only" for="search">Enter Search</label>
<input type="text" class="form-control" id="search" placeholder="Enter {{searchOption}} ..." ng-model="searchText">
</div>
<div id="SearchBydateRange" class="form-group form-group-search col-md-4" ng-show=" searchOption == 'date' ">
<label class=" sr-only" for="search">
Enter Search
</label>
<input type="date" class="form-control col-md-2" id="search" placeholder="From Date" ng-model="fromDate">
<input type="date" class="form-control col-md-2" id="search" placeholder="To Date" ng-model="toDate">
</div>
</div>
Related
I am Using ParsleyJs to validate below shown form, I have been trying to reset the form by calling Reset() function on click of Reset button and i have validated the form using isValid() on form submission and not from the data-parsley-validate in form. After using (#formid).parsley().reset(); in Reset() function the form resets all it's fields but still shows the validator saying "this field is required", i have not found any soution in ParsleyJs documentation.
<form id="Person" class="form-horizontal form-label-left">
<div>
<input id="id" type="hidden" name="id">
</div>
<div class="field item form-group">
<label class="col-form-label col-md-3 col-sm-3 label-align" for="firstname">
First Name
</label>
<div class="col-md-6 col-sm-6 ">
<input type="text" id="firstname" data-parsley-pattern="[a-zA-Z]{3,30}" name="name" class="form-control" data-parsley-trigger="focusout" required>
</div>
</div>
<div class="field item form-group">
<label class="col-form-label col-md-3 col-sm-3 label-align" for="lastname">
Last Name
</label>
<div class="col-md-6 col-sm-6">
<input type="text" id="lastname" data-parsley-pattern="[a-zA-Z]{3,30}" name="name" required data-parsley-trigger="focusout" class="form-control" />
</div>
</div>
<div class="field item form-group">
<label class="col-form-label col-md-3 col-sm-3 label-align" for="phone">
Phone
</label>
<div class="col-md-6 col-sm-6">
<input class="form-control" type="tel" id="phone" name="phone" required="required" data-parsley-pattern="^\d{10}$" data-parsley-maxlength="10" data-parsley-trigger="focusout" />
</div>
</div>
<div class="field item form-group">
<label class="col-form-label col-md-3 col-sm-3 label-align" for="taddress">
Address
</label>
<div class="col-md-6 col-sm-6 ">
<textarea class="form-control" id="address" name="address" rows="3" data-parsley-trigger="focusout" required></textarea>
</div>
</div>
<div class="field item form-group">
<label class="col-form-label col-md-3 col-sm-3 label-align" for="dob">
Date of Birth
</label>
<div class="col-md-6 col-sm-6">
<input class="form-control" id="dob" type="date" name="date" data-parsley-trigger="focusout" min="1900-01-01" max="2020-01-30" pattern="\d{4}-\d{2}-\d{2}" required />
</div>
</div>
<div class="field item form-group">
<label class="col-form-label col-md-3 col-sm-3 label-align">
Email
</label>
<div class="col-md-6 col-sm-6">
<input class="form-control" id="email" name="email" required type="email" data-parsley-trigger="focusout" />
</div>
</div>
<div class="field item form-group">
<label class="col-form-label col-md-3 col-sm-3 label-align" for="ssn">
SSN
</label>
<div class="col-md-6 col-sm-6">
<input class="form-control" pattern="^\d{9}$" id="ssn" type="number" name="ssn" required data-parsley-maxlength="9" data-parsley-trigger="focusout" />
</div>
</div>
<div class="">
<div class="modal-footer">
<button type="button" class="btn btn-secondary" onclick="Reset()" data-dismiss="modal">Close</button>
<br />
<button class="btn btn-primary" id="btnReset" onclick="Reset()">Reset</button>
<br />
<button type="submit" id="btnSubmit" value="validate" class="btn btn-success">Submit</button>
</div>
</div>
</form>
Below shown is the Reset function
function Reset() {
$("#Person")[0].reset();
$('#Person').parsley().reset();
}
Your button is a submit button! So it validates again your form after the reset...
To make it not a submit button use <button type="button" ...>.
Alternatively you could return false in your onclick, or change it to a <div>, or put it outside the form.
I have a form of a prescription. I want to print out that prescription form while submit and also want a proper format in that printout page.
form html
<form role="form" class="registration-form" id="registration_form_id">
<fieldset>
<div class="form-top">
<div class="form-top-left">
<h3>Patient Information</h3>
</div>
<div class="form-top-right">
<i class="fa fa-user"></i>
</div>
</div>
<div class="form-bottom">
<div class="form-group">
<label for="form-first-name">Name</label>
<input type="text" name="form-first-name" placeholder="name" class="form-first-name form-control require" id="name">
</div>
<div class="form-group">
<label for="form-last-name">Age</label>
<input type="number" name="form-last-name" placeholder="Age" class="form-last-name form-control require" id="age" >
</div>
<div class="form-group">
<label for="form-last-name">Mobile Number</label>
<input type="number" name="form-last-name" placeholder="Mobile Number" class="form-last-name form-control require" id="mobile_number" >
</div>
<div class="form-group">
<label for="form-last-name">Religion</label>
<input type="text" name="form-last-name" placeholder="Religion" class="form-last-name form-control require" id="religion" >
</div>
<div class="form-group">
<label for="form-last-name">Occupation</label>
<input type="text" name="form-last-name" placeholder="Occupation" class="form-last-name form-control require" id="occupation" required>
</div>
<div class="form-group">
<h4>Gender</h4>
<div class="row">
<div class="col-md-4">
Male<input class="col-md-4" type="radio" name="gender" value="1">
</div>
<div class="col-md-4">
Female<input class="col-md-4" type="radio" name="gender" value="2">
</div>
<div class="col-md-4">
Other<input class="col-md-4" type="radio" name="gender" value="3">
</div>
</div>
</div>
<div class="form-group">
<h4>Marital status</h4>
<div class="row">
<div class="col-md-4">
Married<input type="radio" class="col-md-4" name="marital_status" value="1">
</div>
<div class="col-md-4">
Single<input type="radio" name="marital_status" class="col-md-4" value="1">
</div>
</div>
</div>
<button type="button" class="btn btn-next">Next</button>
</div>
</fieldset>
<fieldset>
<div class="form-group">
<label for="form-about-yourself">Allergic history</label>
<textarea name="allergic_history" placeholder="Allergic history" class="form-about-yourself form-control " id="allergic_history" ></textarea>
</div>
<div class="form-group">
<label for="form-about-yourself">Personal history</label>
<textarea name="personal_history" placeholder="Personal history" class="form-about-yourself form-control " id="personal_history" ></textarea>
</div>
<button type="button" class="btn btn-previous">Previous</button>
<button type="button" class="btn" id="prescription_form_submition">Submit!</button>
</fieldset>
printout code in js
var divToPrint = document.getElementById('registration_form_id');
newWin= window.open("");
newWin.document.write('<html><style>#media print{body {font-size:16px;} #patient_doctor_info{border-bottom:1px solid #ccc;overflow:hidden;padding:20px 0 10px 0;} #patient_doctor_info span{font-size:18px;} #patient_info{float:left;} #doctor_info{float:right;} #patient_prescription_info{padding:20px 0;overflow:hidden;} #patient_old_prescription{padding-right:5%;border-bottom:1px solid #000;} #patient_new_prescription{overflow:hidden;padding:0 20px;} .new_prescription{font-size : 20px}}</style><body onload="window.print()"><div id="patient_doctor_info"><div id="patient_info"><p><lable>Name :</lable><span><b>'+name+'</b></span></p><p><lable>Mobile Number :</lable><span><b>'+mobile_no+'</b></span></p><p><lable>Age :</lable><span><b>'+age+'</b></span></p><p><lable>Gender :</lable><span><b>'+sex+'</b></span></p></div><div id="patient_prescription_info"><div id="patient_old_prescription"><p><lable>Allergy :</lable><span><b>'+allergic_history+'</b></span></p><p><lable>Social History :</lable><span><b>'+personal_history+'</b></span></p></div></div></body></html>');
newWin.print();
newWin.close();
the print pagelooks like the below image
But I want like below image
So my main questions are.....
how to printout specific div or form value of a webpage using javascript.
How to apply css in that print page?
I have googling this issue several times but still not getting proper solution.
Anybody help please ?
I have code which works:
<div id="type" class="btn-group" data-toggle="buttons">
<label class="btn btn-outline-primary" id="type0">
<input id="type0" name="op" type="radio" value="0" />Wholesale</label>
<label class="btn btn-outline-primary" id="type1">
<input id="type1" name="op" type="radio" value="1" />Retail</label>
</div>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.4.min.js"></script>
<script>
jQuery(function ($) {
$(document).on('change', 'input:radio[id^="type"]', function (event) {
alert("click fired");
});
});
</script>
This can be seen at http://118.127.41.41/~emmarkho1/calculator/test.html
I have integrated this code into my calculator I'm building but it refuses to fire on change.
Full source can be seen # http://118.127.41.41/~emmarkho1/calculator/
Any assistance would be greatly appreciated.
check the below one hope it helps.
$(document).ready(function() {
$('input[type=radio][name=op]').change(function() {
<!-- event.preventDefault(); -->
alert("click fired");
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js" integrity="sha384-Plbmg8JY28KFelvJVai01l8WyZzrYWG825m+cZ0eDDS1f7d/js6ikvy1+X+guPIB" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<div class="container">
<div class="row">
<div class="col-xl-8">
<form name="corflute" id="corflute" action="" method="post">
<div class="form-group row">
<label class="col-sm-3 col-form-label">Customer Type</label>
<div class="col-sm-9">
<div id="type" class="btn-group" data-toggle="buttons">
<label class="btn btn-outline-primary" id="type0">
<input id="type0" name="op" type="radio" value="0" />Wholesale</label>
<label class="btn btn-outline-primary" id="type1">
<input id="type1" name="op" type="radio" value="1" />Retail</label>
</div>
<!-- <div class="btn-group" data-toggle="buttons">
<label class="btn btn-outline-primary id="type1" ">
<input type="radio" value="0" name="type" id="type1" autocomplete="off" >Wholesale
</label>
<label class="btn btn-outline-primary id="type2" active">
<input type="radio" value="1" name="type" id="type2" autocomplete="off" checked >Retail
</label>
</div> -->
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label label-top">Size<br><span class="label-info">metres</span></label>
<div class="col-sm-3">
<label class="center">Width</label>
<input class="form-control" type="text" onChange='this.form.submit();' name="width" id="width" value="">
</div>
<div class="col-sm-3">
<label class="center">Height</label>
<input class="form-control" type="text" onchange='myfuction();' name="height" id="height" value="">
</div>
<div class="col-sm-3">
<label class="center">Quantity</label>
<input class="form-control" type="text" name="quantity" id="quantity" value="1">
</div>
</div>
<div class="form-group row">
<label class="col-sm-6 col-form-label top">Signs per sheet<br><span class="label-info">sheet size 2440mm x 1220mm</span></label>
<div class="col-sm-3">
<input class="form-control" type="text" name="sps" id="sps" value="1">
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label">Artwork</label>
<div class="col-sm-9">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-outline-primary active">
<input type="radio" value="0" name="artwork" id="art1" autocomplete="off">Basic
</label>
<label class="btn btn-outline-primary ">
<input type="radio" value="1" name="artwork" id="art2" autocomplete="off">Standard
</label>
<label class="btn btn-outline-primary ">
<input type="radio" value="2" name="artwork" id="art3" autocomplete="off">Complex
</label>
</div>
</div>
</div>
<div class="form-group row">
<button type="submit" name="corflute" class="right btn btn-warning">Calculate</button>
</div>
</form>
<div class="divider"></div>
</div>
<div class="col-xl-4">
<div class="col-md-12 right-sidebar">
<div class="side-blocks">
<form name="CorfluteSettings" id="CorfluteSettings" action="" method="post">
<input type="submit" name="Settings" style="visibility: hidden;" />
<div class="form-group row">
<label class="col-xs-8 col-form-label top">Substrate Cost<br><span class="label-info">Per Square Metre</span></label>
<div class="col-xs-4">
<input class="form-control" type="text" name="subcost" id="subcost" onchange="javascript:document.forms['CorfluteSettings'].submit()" value="5.5">
</div>
</div>
<div class="form-group row">
<label class="col-xs-8 col-form-label top">Mark-up<br><span class="label-info">Default 250%</span></label>
<div class="col-xs-4">
<input class="form-control" type="text" name="submu" id="submu" onchange="javascript:document.forms['CorfluteSettings'].submit()" value="250">
</div>
</div>
<div class="form-group row">
<label class="col-xs-8 col-form-label top">Substrate rate<br><span class="label-info">Per Square Metre</spane></label>
<div class="col-xs-4">
<input disabled class="form-control" type="text" name="subrate" id="subrate" value="19.25">
</div>
</div>
</div>
<div class="side-blocks">
<div class="form-group row">
<label class="col-xs-8 col-form-label top">Print Media Cost<br><span class="label-info">Per Square Metre</span></label>
<div class="col-xs-4">
<input class="form-control" type="text" name="pmc" id="pmc" onchange="javascript:document.forms['CorfluteSettings'].submit()" value="4.5">
</div>
</div>
<div class="form-group row">
<label class="col-xs-8 col-form-label top">Solvent Ink Cost<br><span class="label-info">Per Square Metre</span></label>
<div class="col-xs-4">
<input class="form-control" type="text" name="sic" id="sic" onchange="javascript:document.forms['CorfluteSettings'].submit()" value="5">
</div>
</div>
<div class="form-group row">
<label class="col-xs-8 col-form-label top">Mark up<br><span class="label-info">default 250%</spane></label>
<div class="col-xs-4">
<input class="form-control" type="text" name="printmu" id="subrate" value="250">
</div>
</div>
<div class="form-group row">
<label class="col-xs-8 col-form-label top">Print Rate<br><span class="label-info">Per Square Metre</spane></label>
<div class="col-xs-4">
<input disabled class="form-control" type="text" name="printrate" id="printrate" value="33.25">
</div>
</div>
</div>
<div class="side-blocks last">
<div class="form-group row">
<label class="col-xs-8 col-form-label top">Mount Time<br><span class="label-info">Per Panel(mins)</span></label>
<div class="col-xs-4">
<input class="form-control" type="text" name="mt" id="bt" onchange="javascript:document.forms['CorfluteSettings'].submit()" value="15">
</div>
</div>
<div class="form-group row">
<label class="col-xs-8 col-form-label top">Track Time<br><span class="label-info">Per Cut(mins)</span></label>
<div class="col-xs-4">
<input class="form-control" type="text" name="tt" id="tt" onchange="javascript:document.forms['CorfluteSettings'].submit()" value="2">
</div>
</div>
<div class="form-group row">
<label class="col-xs-8 col-form-label top">Hourly Rate<br><span class="label-info">Dollars Per hour</spane></label>
<div class="col-xs-4">
<input class="form-control" type="text" name="hr" id="hr" onchange="javascript:document.forms['CorfluteSettings'].submit()" value="110">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
On your page you are using inputs with different ids - art1, art2 etc.
So you should update the code to:
jQuery(function ($) {
$(document).on('change', 'input:radio[id^="art"]', function (event) {
alert("click fired");
});
});
or in your particular case shorter:
$('input:radio[id^="art"]').change(function(){
alert("click fired");
});
When using jQuery effect, my div collapses a little as it is sliding and the div coming in is also collapsed a little. It will be a responsive website, so I do not think I should put a width or height. I tried one suggestion I read about using position: absolute, but it did not produce the result I wanted. Is there a way to keep the div from collapsing any? I want each div to look the same when sliding as it does when not sliding.
This fiddle shows the effect and how the divs look when sliding.
CODE:
<div class="well basicInformation">
<div class="list-group">
<a href="#" class="list-group-item active">
<h4 class="list-group-item-heading">Basic Information</h4>
</a>
</div>
<div class="row">
<div class="col-md-5">
<label for="firstname">First Name</label>
<input type="text" id="firstname" class="form-control" placeholder="First name" ng-model="firstname" required autofocus />
</div>
<div class="col-md-2">
<label for="MI">Middle Initial</label>
<input type="text" id="MI" class="form-control" ng-model="middlename" />
</div>
<div class="col-md-5">
<label for="lastname">Last Name</label>
<input type="text" id="lastname" class="form-control" placeholder="Last name" ng-model="lastname" required />
</div>
</div>
<div class="row">
<div class="col-md-12">
<label for="address">Address</label>
<input type="text" id="address" class="form-control" placeholder="Address Line 1" ng-model="address" required />
</div>
</div>
<div class="row">
<div class="col-md-12">
<label for="address2">Address 2</label>
<input type="text" id="address2" class="form-control" placeholder="Address Line 2" ng-model="address2" />
</div>
</div>
<div class="row">
<div class="col-md-3">
<label for="city">City</label>
<input type="text" id="city" class="form-control" placeholder="City" ng-model="city" />
</div>
<div class="col-md-2">
<label for="address2">Locale/State</label>
<input type="text" id="locale" class="form-control" placeholder="Locale/State" ng-model="locale" />
</div>
<div class="col-md-2">
<label for="address2">Region</label>
<input type="text" id="region" class="form-control" placeholder="Region" ng-model="region" />
</div>
<div class="col-md-3">
<label for="address2">Country</label>
<input type="text" id="country" class="form-control" placeholder="Country" ng-model="country" />
</div>
<div class="col-md-2">
<label for="address2">Postal Code</label>
<input type="text" id="postalCode" class="form-control" placeholder="Postal Code" ng-model="postalCode" />
</div>
</div>
<div class="row">
<div class="col-md-6">
<label for="phone">Phone (Default)</label>
<input type="radio" id="radioHome1" /><label> Home</label>
<input type="radio" id="radioMobile1" /><label> Mobile</label>
<input type="tel" id="phone" class="form-control" placeholder="Phone" ng-model="contactData" required />
</div>
<div class="col-md-6">
<label for="phone2">Phone 2 (Alternate)</label>
<input type="radio" id="radioHome2" /><label> Home</label>
<input type="radio" id="radioMobile2" /><label> Mobile</label>
<input type="tel" id="phone2" class="form-control" placeholder="Phone 2" ng-model="contactData2" />
</div>
</div>
<div class="row">
<div class="col-md-6">
<label for="email">Email address</label>
<input type="email" id="email" class="form-control" placeholder="Email address" ng-model="emailAddress" required />
</div>
<div class="col-md-6">
<label for="password">Password</label>
<input type="password" id="password" class="form-control" placeholder="Password" ng-model="password" required />
</div>
</div>
<div class="row">
<div class="col-md-offset-10 col-md-2">
<button id="submitBasicInformation" class="btn btn-lg btn-primary btn-block">Next</button>
</div>
</div>
</div>
<div class="well faaInformation" style="display: none;">
<div class="list-group">
<a href="#" class="list-group-item active">
<h4 class="list-group-item-heading">FAA Required Information</h4>
</a>
</div>
<div class="row">
<div class="col-md-6">
<label for="federalRegistrationId">Federal Registration ID</label>
<input type="text" id="federalRegistrationId" class="form-control" placeholder="Federal Registration ID" ng-model="federalRegistrationId" required />
</div>
<div class="col-md-6">
<label for="pilotNumber">Pilot Number</label>
<input type="text" id="pilotNumber" class="form-control" ng-model="pilotNumber" required />
</div>
</div>
<div class="row">
<div class="col-md-offset-10 col-md-2">
<button id="submitRegistration" class="btn btn-lg btn-primary btn-block" type="submit">Submit</button>
</div>
</div>
</div>
var hideoptions = { "direction": "left", "mode": "hide" };
var showoptions = { "direction": "right", "mode": "show" };
$("#submitBasicInformation").on('click', function () {
$.when($(".basicInformation").effect("slide", hideoptions, 1250)).then(function (data, textStatus, jqXHR) {
$(".faaInformation").effect("slide", showoptions, 1250);
});
});
It looks like your animation is adding style attributes during the animation. You can see this if you slow down the animation and inspect the element. It's adding a static height and width during the animation. I was able to fix the height and width by adding this to your .faaInformation css
height: auto !important;
width: auto !important;
Hi I've a form and i'm unable to disable the submit button if the fields are empty. Below is the code can any one help me to understand what might be problem?
<modal title="Add Navigation" visible="showAddModal">
<form id="addform" class="form-horizontal">
<div class="modal-body">
<div ng-classs="form-group">
<label class="col-sm-2 control-label">Client Type</label>
<div class="col-sm-10">
<select name="account" class="form-control m-b w-md" ng-model="navData.clientType" ng-required="true">
<option value="android">Android</option>
<option value="ios">iOs</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Client Version</label>
<div class="col-sm-10">
<input type="text" class="form-control w-md" ng-model="navData.clientVersion" placeholder="" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Key Word</label>
<div class="col-sm-10">
<input type="text" class="form-control w-md" ng-model="navData.keyWord" placeholder="" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Value </label>
<div class="col-sm-10">
<input type="text" class="form-control w-md" ng-model="navData.value" placeholder="" required>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal">Cancel</button>
<button class="btn btn-primary" ng-disabled="addform.$invalid" ng-click="addNav()">Add</button>
</div>
</form>
</modal>
From https://docs.angularjs.org/guide/forms#binding-to-form-and-control-state:
A form is an instance of
FormController.
The form instance can optionally be published into the scope using the
name attribute.
You have to use the name attribute to make the form instance available in the $scope, but you're using the id attribute:
<form name="addform" class="form-horizontal">
<!-- ... -->
</form>