如何通过URL传递两个用户输入日期
我有一个要求我需要使用< a href>
通过URL传递两个日期(date和dateto),该日期显示了日期的报告。格式yyyy-mm-dd。 以下是我正在使用的代码。 这里 datefrom 和 dateto 在URL中将是用户选择的日期。
我已经使用无线电按钮选择了报告中要生成的列。用户将选择第一组列或第二组列。并且所选的一组列将在报告中显示。
从日期选择 ,日期和 集合之后,用户将单击“生成报告”按钮,该按钮转到另一个页面它显示了报告。
我该如何传递这两个日期值和无线电按钮条件以选择列。
UI在FTL(Freemarker)中。我还附上一个UI的图像,以更好地理解。
有两个不同的URL用于两组不同的列。 URL是
- 第一组列:http:// localhost:9191/preview?__report = prodence_1.rptdesign& __format = pdf& datefrom = 2022-06-10&
- dateto //localhost:
9191/preview?__report = production_2.rptdesign& __format = pdf&; datefrom = 2022-06-10&dateto = 2022-06-10如果用户选择了第1列列One < a href&a href> dateto = 2022-06-10
将使用,如果用户选择第二组列,将使用另一列< a href>
。我尚未完成编码部分。我该如何在FTL中实现这一目标?
<input type="date" id="quality-fromdate">
<input type="date" id="quality-toDate">
<input id="radiobutton1" type="radio" name="radio-button">
<div class="select-columns-options-1" id="select-columns-options1">
<option value="tasks">Product Name</option>
<option value="tasks">Order Id</option>
<option value="tasks">Quantity Ordered</option>
<option value="tasks">Quantity To Produce</option>
<option value="tasks">Due Date</option>
<option value="tasks">Estimated Completion Time</option>
</div>
<input id="radiobutton2" type="radio" name="radio-button">
<div class="select-columns-options-2">
<option value="tasks">Product Name</option>
<option value="tasks">Quantity Ordered</option>
<option value="tasks">Quantity To Produce</option>
</div>
<a href="http://localhost:9191/preview?__report=production_1.rptdesign&__format=pdf&DateFrom=2022-06-10&DateTo=2022-06-10">Generate Report</a>
I have a requirement where I need to pass two dates(DateFrom and DateTo) through the URL using <a href>
which goes to another page where it shows the report of that dates.both the dates are in format yyyy-mm-dd.
below is the code I'm using.
here DateFrom and DateTo in the URL will be the dates that the user selects.
I have used radio buttons to select the columns to be generated in the report. user will choose either 1st set of columns or 2nd set of columns. and the chosen set of columns will be shown in the report.
After choosing from date, to date, and set of columns, the user will click on the generate report button which goes to the other page where it shows the report.
How shall I pass those two date values and radio button conditions for selecting columns.
the UI is in FTL(freemarker). I'm also attaching an image of the UI for better understanding.
there are two different URLs for two different sets of columns.
the URLs are
- 1st set of columns: http://localhost:9191/preview?__report=production_1.rptdesign&__format=pdf&DateFrom=2022-06-10&DateTo=2022-06-10
- 2nd set of columns: http://localhost:9191/preview?__report=production_2.rptdesign&__format=pdf&DateFrom=2022-06-10&DateTo=2022-06-10
if the user selects 1st set of columns one <a href>
will be used and if the user selects 2nd set of columns another <a href>
will be used. I haven't completed the coding part yet. how shall I achieve this in FTL?
<input type="date" id="quality-fromdate">
<input type="date" id="quality-toDate">
<input id="radiobutton1" type="radio" name="radio-button">
<div class="select-columns-options-1" id="select-columns-options1">
<option value="tasks">Product Name</option>
<option value="tasks">Order Id</option>
<option value="tasks">Quantity Ordered</option>
<option value="tasks">Quantity To Produce</option>
<option value="tasks">Due Date</option>
<option value="tasks">Estimated Completion Time</option>
</div>
<input id="radiobutton2" type="radio" name="radio-button">
<div class="select-columns-options-2">
<option value="tasks">Product Name</option>
<option value="tasks">Quantity Ordered</option>
<option value="tasks">Quantity To Produce</option>
</div>
<a href="http://localhost:9191/preview?__report=production_1.rptdesign&__format=pdf&DateFrom=2022-06-10&DateTo=2022-06-10">Generate Report</a>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不会在此处使用
&lt; a&gt;
,因为必须动态生成URL。这是使用按钮的示例,并在单击按钮时弄清楚URL。如果您绝对必须使用&lt; a&gt;
,则可能必须绑定到更改日期和收音机的事件中,并更新
href <
href < /代码>
&lt; a&gt;
的/代码>。I wouldn't use
<a>
here, since the url has to be generated dynamically. Here's an example using a button and figuring out the url when the button is clicked. If you absolutely have to use<a>
, you'd probably have to bind into thechange
events of the dates and the radios and update thehref
of the<a>
that way.您还有很多要走的方法,这里是使用EventListener和URL对象使用的工作版本,
我没有测试您还需要与ID等更一致的日期
等。我假设您的链接需要两个选择(它们是代码中的Divs)
You had quite a bit to go, here is working version using eventListener and URL object
I am not testing the dates
You also needed to be more consistent with IDs etc. I assume your link needed the two selects (they were divs in your code)