我使用Angular v1.2.14并通过验证制作此表单。
<form role="form" name="exchangeForm" ng-submit="submitExchange(exchange)" novalidate>
<div class="form-group">
<input type="text" class="form-control input-lg" placeholder="Wat is je naam?" name="name" ng-model="exchange.name" required>
</div>
<div class="form-group">
<input type="email" class="form-control input-lg" placeholder="Wat is je e-mail" name="email" ng-model="exchange.email" required>
</div>
<div class="form-group">
<input type="text" class="form-control input-lg" placeholder="Waar werk je?" name="work" ng-model="exchange.work" required>
</div>
<button type="submit" class="btn btn-success btn-block btn-lg" ng-disabled="exchangeForm.$invalid">Prijs claimen</button>
</form>
这是保存数据的控制器部分:
$scope.submitExchange = function(data)
{
PhoneGap.ready().then(function()
{
var exchange = new Exchange({uuid: $window.device.uuid});
exchange.name = data.name;
exchange.email = data.email;
exchange.work = data.work;
exchange.$save(function(result)
{
round.state = 3;
round.player_name = data.name;
round.player_email = data.email;
round.player_work = data.work;
$route.reload();
});
});
};
当我在iPhone上运行Phonegap应用程序时,一切正常。但是在Android 4.0.3上,即使我填写了所有字段,提交按钮也会保持禁用状态。
答案 0 :(得分:0)
在这种情况下,一旦验证完成,手动删除按钮的活动状态可能是最简单的。
您可以致电:
$(":submit").parent().removeClass("ui-btn-active");