简体   繁体   English

使用链接自动填充另一个表单,有可能吗?

[英]auto-populate another form using a link, it is possible?

I'm trying to make an app on Android that send an URI that auto-populate the "RFC Emisor" and "RFC Receptor" of this web page: 我正在尝试在Android上制作一个应用程序,它发送一个自动填充此网页的“RFC Emisor”和“RFC Receptor”的URI:

https://verificacfdi.facturaelectronica.sat.gob.mx , if I'm correct those two inputs have the id of: https://verificacfdi.facturaelectronica.sat.gob.mx ,如果我是正确的那两个输入的id为:

  • ctl00_MainContent_TxtRfcEmisor ctl00_MainContent_TxtRfcEmisor

  • ctl00_MainContent_TxtRfcReceptor ctl00_MainContent_TxtRfcReceptor

I already tried this but it didn't work: 我已经尝试了这个,但它不起作用:

https://verificacfdi.facturaelectronica.sat.gob.mx/&ctl00_MainContent_TxtRfcEmisor=123456789&ctl00_MainContent_TxtRfcReceptor=123456789

there is a way to achieve what I want? 有办法实现我想要的吗?

The short answer is no. 最简洁的答案是不。 The browser won't automatically detect the URL parameter and pre-populate any form fields. 浏览器不会自动检测URL参数并预先填充任何表单字段。 A back-end PHP / ASP.NET page can read the value from the request and generate the HTML fields with the specified values. 后端PHP / ASP.NET页面可以读取请求中的值并生成具有指定值的HTML字段。 Alternatively, the page could use JavaScript to set the field values when the document finishes loading. 或者,页面可以使用JavaScript在文档完成加载时设置字段值。

But all of this depends on changes to the target web page. 但所有这些都取决于对目标网页的更改。 If you do not have the ability to modify that page, I'm afraid there's very little you could do. 如果你没有能力修改那个页面,我担心你能做的很少。

You might be able to duplicate the form on your own page, and send the form data to the target—effectively bypassing the form on the other page and 'faking' your own, but if the target system does some kind of validation to prevent posting forms across domain names, this probably won't work either. 您可以在自己的页面上复制表单,并将表单数据发送到目标 - 有效地绕过另一页上的表单并“伪造”您自己的表单,但如果目标系统进行某种验证以防止发布跨域名的表单,这可能也不起作用。 You may have create the form and process it yourself, replicating the entire form interaction programmatically when a user submits a form to your server. 您可能已创建表单并自行处理,当用户将表单提交到服务器时,以编程方式复制整个表单交互。 In any case, none of these options are particularly graceful. 无论如何,这些选项都不是特别优雅。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM