Post 带有模板 url 的 amp-form
Post an amp-form with a templated url
我们有一个由 amp-form 和输入文本组成的搜索栏。在验证时,我们想重定向移动站点上的页面,但我们没有找到一种方法来将 url 模板化为类似这样的内容:
<form method="get" action="https://example.com/search/'+searchword+'.html'">
<input type="text" autocomplete="off" id="searchbar">
</form>
当然,我们不能更改url,以在查询字符串中传递参数。
到目前为止,我们尝试使用 amp-bind,但表单 [action] 不是有效目标。
您不能直接更改 URL,但 amp-form
会将您的输入字段值附加到 URL 作为查询参数。这种形式:
<form method="get" action="https://example.com/search/">
<input type="text" autocomplete="off" id="searchbar" name="query" value="hello">
</form>
产生以下请求 URL:https://example.com/search/?query=hello
。
我还建议提交功能请求 here 以启用对表单操作的绑定。
我们有一个由 amp-form 和输入文本组成的搜索栏。在验证时,我们想重定向移动站点上的页面,但我们没有找到一种方法来将 url 模板化为类似这样的内容:
<form method="get" action="https://example.com/search/'+searchword+'.html'">
<input type="text" autocomplete="off" id="searchbar">
</form>
当然,我们不能更改url,以在查询字符串中传递参数。
到目前为止,我们尝试使用 amp-bind,但表单 [action] 不是有效目标。
您不能直接更改 URL,但 amp-form
会将您的输入字段值附加到 URL 作为查询参数。这种形式:
<form method="get" action="https://example.com/search/">
<input type="text" autocomplete="off" id="searchbar" name="query" value="hello">
</form>
产生以下请求 URL:https://example.com/search/?query=hello
。
我还建议提交功能请求 here 以启用对表单操作的绑定。