i have page 1 input field takes input , pre-fills form in bootstrap modal.
<script> $(function(){ $('#examplemodal').on('show.bs.modal', function (event) { var button = $(event.relatedtarget); var modal = $(this); var recipient = document.getelementbyid("inputname").value; modal.find('.companypostcode input').val(recipient); }); }); </script> the form validated using same way shown in tutorial: https://scotch.io/tutorials/submitting-ajax-forms-the-angularjs-way
but once rest of form filled in , submit clicked, validation marks postcode field not being filled.
i can click field , enter space , work fine shouldn't have this.
process php checks empty inputs follows:
if (empty($_post['name'])) $errors['name'] = 'name required.'; if (empty($_post['companyname'])) $errors['companyname'] = 'company name required.'; if (empty($_post['postcode'])) $errors['postcode'] = 'company postcode required.'; if (empty($_post['emailaddress'])) $errors['emailaddress'] = 'email address required.'; if (empty($_post['telephonenumber'])) $errors['telephonenumber'] = 'telephone number required.'; any highly appreciated.
if form in bootstrap modal uses angularjs validation, have notify angularjs model has changed. otherwise have updated value in input field, not in underlying model.
but without actual code at, quessing
most need call $scope.$apply()
like this
<script> $(function(){ $('#examplemodal').on('show.bs.modal', function (event) { var button = $(event.relatedtarget); var modal = $(this); var recipient = document.getelementbyid("inputname").value; modal.find('.companypostcode input').val(recipient); //todo: notify angularjs changed value $scope.$apply(); }); }); </script>
Comments
Post a Comment