当我使用cordovaInappbrowser提交form.html表单值时不更改 当使用inappbrowser加载form.html时。 form.html在表单上显示默认值 是不是支持动态表单提交?
以下是我的代码
$cordovaInAppBrowser.open('templates/payumoneyPaymentForm.html','_blank', options)
.then(function(event) {
$scope.payUpaymentForm = $rootScope.paymentDetails;
prompt("success "+JSON.stringify(event));
})
.catch(function(event) {
prompt("error "+event);
});
$rootScope.$on('$cordovaInAppBrowser:loadstart', function(e, event){
});
$rootScope.$on('$cordovaInAppBrowser:loadstop', function(e, event){
$cordovaInAppBrowser.executeScript({
code:"document.getElementById('payUMoneyPaymentFormData').submit();"
});
});
$rootScope.$on('$cordovaInAppBrowser:loaderror', function(e, event){
prompt("loaderror");
});
$rootScope.$on('$cordovaInAppBrowser:exit', function(e, event){
});
showing blank value in html
following my html page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form id="payUMoneyPaymentFormData" name="payuForm" action="https://test.payu.in/_payment" method="POST">
<!-- BEGIN - Mandatory Config Parameters -->
<ion-item>
<ion-list>
<input type="text" id="amount" name="amount" value="{{payUpaymentForm.amount}}"/>
<div style="margin-top : 5%;">
<span>Key*</span><br>
<label class="item item-input">
<input type="text" id="key" name="key" maxlength="1000" value="{{payUpaymentForm.key}}" />
</label>
</div>
</ion-list>
<ion-list>
<div style="margin-top : 5%;">
<span>Hash*</span><br>
<label class="item item-input">
<input type="hidden" id="hash" name="hash" emaxlength="1000" value="{{payUpaymentForm.hash}}" />
</label>
</div>
</ion-list>
<ion-list>
<div style="margin-top : 5%;">
<span>TxnId*</span><br>
<label class="item item-input">
<input type="hidden" name="txnid" maxlength="1000" value="{{payUpaymentForm.txnid}}" />
</label>
</div>
</ion-list>
<ion-list>
<div style="margin-top : 5%;">
<span>Service Provider*</span><br>
<label class="item item-input">
<input type="hidden" id="service_provider" maxlength="1000" name="service_provider" value="{{payUpaymentForm.service_provider}}" />
</label>
</div>
</ion-list>
<!-- END - Mandatory Config Parameters -->
<!-- BEGIN - Mandatory Parameters-->
<ion-list>
<div style="margin-top : 5%;">
<span>Firstname*</span><br>
<label class="item item-input">
<input type="hidden" id="firstname" name="firstname" value="{{payUpaymentForm.firstname}}" />
</label>
</div>
</ion-list>
<ion-list>
<div style="margin-top : 5%;">
<span>Email*</span><br>
<label class="item item-input">
<input type="text" id="email" name="email" value="{{payUpaymentForm.email}}" />
</label>
</div>
</ion-list>
<ion-list>
<div style="margin-top : 5%;">
<span>productInfo*</span><br>
<label class="item item-input">
<input type="hidden" id="productinfo" name="productinfo" value="{{payUpaymentForm.productinfo}}" />
</label>
</div>
</ion-list>
<input type="hidden" id="phone" name="phone" value="{{payUpaymentForm.phone}}" />
<input type="hidden" name="surl" value="{{payUpaymentForm.surl}}" />
<input type="hidden" name="furl" value="{{payUpaymentForm.furl}}" />
<!-- END - Mandatory Parameters-->
<!--BEGIN - Optional Parameters-->
<input type="hidden" name="address1" value="" />
<input type="hidden" name="address2" value="" />
<input type="hidden" name="city" value="" />
<input type="hidden" name="state" value="" />
<input type="hidden" name="country" value="" />
<input type="hidden" name="zipcode" value="" />
<input type="submit">
</ion-item>
<!-- END - Optional Parameters -->
</form>
</body>
</html>
答案 0 :(得分:0)
您需要使用Execute Script在loadstop或load start事件上填写动态feild值。
$ rootScope。$ on(&#39; $ cordovaInAppBrowser:loadstop&#39;,function(e,event){
$cordovaInAppBrowser.executeScript({
code:"document.getElementById('service_provider').val('somevalue');document.getElementById('payUMoneyPaymentFormData').submit();"
});
});