We are using the payment module we have a form which creates a tenant
What is the best way of posting the form to the prepayment page using ajax so that the form can be validated by abp before being sent to the prepayment onpost method.
payment module example uses
localredirectpreservemethod()
the form we have is not in not in a modal it is just on a page.
3 Answer(s)
-
0
well may be this is not the best way .... becuase i am not using Ajax and becuase my form is using the Post method I have written some javasciprt to get over the hurdel of validating the TenantName and confirm password fields.
var abp = abp || {}; $(function () { var subscriptionService = window.desertFire.ppm.subscriptions.subscription; var $frmBuy = $("#frmBuy"); var $btnRegisterTenant = $("#btnRegisterTenant"); var $tenantName = $("#txtTenantName"); var $txtAdminPassword = $("#txtAdminPassword"); var $txtConfirmAdminPassword = $("#txtConfirmAdminPassword"); $btnRegisterTenant.click(function (e) { e.preventDefault(); var isTenantNameAlreadyExist = false; subscriptionService.isTenantNameAlreadyExist( $tenantName.val() ).then(function (isTenantNameAlreadyExist) { console.log(isTenantNameAlreadyExist); if (isTenantNameAlreadyExist) { abp.message.error("Sorry this Tenant Name: '" + $tenantName.val() + "' already exists, please choose another"); } else if ($txtAdminPassword.val() != $txtConfirmAdminPassword.val()) { abp.message.error("The Password do not match, please ensure that the confirm password is the same!"); } else { $frmBuy.submit(); } }); }); });
Dear Volosoft Team this is method the right approach?
-
0
Hi @learnabp
There are 2 ways to achieve that,
- As you did, control it on UI
- Using controller. You can post your data to a Controller, then validate and redirect to payment service from your Controller.
-
0
This question has been automatically marked as stale because it has not had recent activity.