// Add your javascript here
angular.module('myApp',[])
.controller('formCtrl',function($scope){
$scope.password = "";
$scope.splatform = "Test1";
$scope.platforms= ["Test1", "Test2"];
$scope.sendingData = false;
$scope.tradingAccountId = "test1";
$scope.tradingAccounts=["test1", "test2"]
$scope.processForm = function() {
console.log("Triggered form");
alert("OOOPS - the form was submitted on Enter");
}
});
angular.module('myOtherApp',[])
.controller('formCtrl',function($scope){
$scope.tradingAccountId = "test1";
$scope.tradingAccounts=["test1", "test2"];
$scope.password = "";
$scope.isLoading = false;
$scope.processForm = function() {
console.log("Triggered form");
alert("OOOPS - the form was submitted on Enter");
}
});
/* Put your css in here */
.form-group
{
width: 400px;
padding: 0px 20px;
margin: 10px 20px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>AngularJS Form Inconsistent behaviour</title>
<link data-require="bootstrap-css" data-semver="3.1.1" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<link href="style.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="myApp">
<h3>Form submits on Enter without a submit button</h3>
<h4>Click on Password and press Enter</h4>
<div ng-controller="formCtrl">
<form id="signupform" name="signupform" class="form-horizontal" autocomplete="off" ng-submit="processForm()" role="form" novalidate="">
<fieldset ng-disabled="sendingData">
<div class="form-group" ng-hide="isPredefined" id="field-platform">
<label class="col-sm-3 control-label" for="currency">Platform</label>
<div class="col-sm-9">
<select class="form-control" name="platform" id="platform" ng-model="splatform" ng-options="platform for platform in platforms" required></select>
</div>
</div>
<div class="form-group" id="field-password">
<label class="col-sm-3 control-label" for="password">Password</label>
<div class="col-sm-9">
<input type="password" autocomplete="off" id="password" name="password" class="form-control" ng-model="password" required>
</div>
</div>
<!--
<hr/>
<div class="form-group text-right" id="field-submit">
<div class="col-sm-12">
<button type="submit" class="btn btn-submit" ng-disabled="sendingData" id="buttonSubmit">Submit</button>
</div>
</div>-->
</fieldset>
</form>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>AngularJS Form Inconsistent behaviour</title>
<link data-require="bootstrap-css" data-semver="3.1.1" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<link href="style.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="myOtherApp">
<h3>Form doesn't submit on enter</h3>
<h4>Click on Password and press Enter</h4>
<div ng-controller="formCtrl">
<form autocomplete="off" role="form" id="withdrawalDetails" class="form-horizontal" ng-submit="processForm()" name="withdrawalForm" novalidate="" cg-busy="loading">
<input style="display: none" type="text" name="fakeusernameremembered">
<input style="display: none" type="password" name="fakepasswordremembered">
<fieldset ng-disabled="isLoading">
<div class="form-group ">
<label class="col-sm-3 control-label" for="account">Platform</label>
<div class="col-sm-9">
<select id="account" name="account" class="form-control" ng-model="tradingAccountId" ng-options="tradingAccount for tradingAccount in tradingAccounts" required></select>
</div>
</div>
<div class="form-group ">
<label class="col-sm-3 control-label" for="myLcgPassword">Password</label>
<div class="col-sm-9">
<input type="password" autocomplete="new-password" id="myLcgPassword" name="myLcgPassword" class="form-control" ng-model="password" required>
</div>
</div>
<!--
<hr/>
<div class="form-group text-right" id="field-submit">
<div class="col-sm-12">
<button type="submit" class="btn btn-submit" ng-disabled="sendingData" id="buttonSubmit">Submit</button>
</div>
</div>-->
</fieldset>
</form>
</div>
</body>
</html>