1个按钮,1个表单但有2个动作 [英] 1 Button, 1 Form but 2 actions

查看:84
本文介绍了1个按钮,1个表单但有2个动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们我有一点问题。

我需要1个表格中的2个动作。

一个动作是我自己的一方(我想插入......)在数据库中),另一个操作将您带到支付系统。

有人知道怎么做?

Hey guys I have a little problem.
I need 2 actions in 1 form.
the one action is on my own side (I want to insert sth. in a database) and the other action takes you to a payment system.
Somebody knows how to do this?

推荐答案

典型的推荐方法将是:



1.使用自定义逻辑将表单提交到您的页面。 (将必要的数据插入数据库等)

2.页面验证数据,如果验证失败 - 再次显示表单并显示验证错误

3.如果数据正常 - 保存必要的数据进入数据库和问题301重定向到一些导航到付款引擎页面

建议重定向,以避免在用户按下重新加载页面时重新提交表单。

4.导航到付款引擎页面可能包含表单标记,其中包含付款引擎预期的字段+ JavaScript代码,以便在加载页面后提交表单。最好在此表单上显示提交按钮。如果您未在5秒内导航到付款引擎,则可以按此处
Typical recommended approach would be:

1. Form is submitted to your page with custom logic. ( insert necessary data into db etc)
2. Page validates data, if validation fails - displays form again with validation errors
3. If data are OK - saves necessary data into db and issues 301 redirect to some "navigate to payment engine" page
Redirect is recommended to avoid form resubmitting if user presses reload page.
4. "Navigate to payment engine" page might include form markup with fields expected by payment engine + JavaScript code to submit form once page is loaded. It is good idea to show submit button on this form as well. Text could be "press here if you are not navigated to payment engine in 5 seconds"


这篇关于1个按钮,1个表单但有2个动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆