简体   繁体   English

Flask /否JS:可以在没有JavaScript的情况下制作动态下拉表单应用程序吗? (仅python和HTML)

[英]Flask/ no JS: can a dynamic drop down form app be made without javascript? (only python and HTML)

Update: I don't want to use JS to generate forms or navigate through them 更新:我不想使用JS生成表单或浏览表单

I need to create an application that generates a drop down menu with items obtained from a list of folders in the local host and then generates another drop down menu based on that. 我需要创建一个应用程序,该应用程序生成一个下拉菜单,其中包含从本地主机中的文件夹列表中获取的项目,然后基于该列表生成另一个下拉菜单。 Then, based on the second selection it needs to either present a list of scripts or another list of folder after which some other scripts will be available. 然后,基于第二个选择,它需要显示一个脚本列表或另一个文件夹列表,之后其他一些脚本将可用。

When the final script is selected two more fields should show up in which the user should enter and select two more values. 选择最终脚本后,将显示另外两个字段,用户应在其中输入并选择另外两个值。

With all these values then a command on the local host will be executed - the values will be passed as parameters. 使用所有这些值,然后将在本地主机上执行命令-这些值将作为参数传递。

Can this be done without JS? 不用JS就可以做到吗?

I have enough Python/Flask and HTML skills to do this in a reasonable amount of time, but I don't have the necessary JS skills or the time to learn JS. 我有足够的Python / Flask和HTML技能可以在合理的时间内完成此操作,但是我没有必要的JS技能或学习JS的时间。 Some pointers would be great :) 一些指针会很棒:)

Thank you 谢谢

Flask executes on the server side and cannot be used to gather directory information about the local host. Flask在服务器端执行,不能用于收集有关本地主机的目录信息。 You need JavaScript, and even there there is not a standard interface that will work across all browsers. 您需要JavaScript,甚至没有标准的界面可以在所有浏览器中使用。

See SO answers here: Local file access with javascript 在此处查看答案: 使用javascript进行本地文件访问

and MDN documentation for Firefox here: https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API 和Firefox的MDN文档: https//developer.mozilla.org/zh-CN/docs/Web/API/File_and_Directory_Entries_API

and a more recent SO question with less browser-specific solutions among the answers here: Select directory path in javascript 还有一个更新的SO问题,其中的浏览器专用解决方案较少,这里的答案是: 在javascript中选择目录路径

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

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