ข้ามไปเนื้อหา

ผลต่างระหว่างรุ่นของ "CuneiForm"

เพิ่มขึ้น 805 ไบต์ ,  9 เมษายน 2567
บรรทัดที่ 252: บรรทัดที่ 252:


==== Sending Data ====
==== Sending Data ====
Normal submission behaviour of a FlaskForm is to send a POST request to the same currently displaying route, then the page is refreshed. This approach, although neat and clean, creates a choppy experience for users. CuneiFox offers a way to override this behaviour using the following attributes:
Normal submission behaviour of a FlaskForm is to send a POST request to the same currently displaying route, then the page is refreshed. This approach, although neat and clean, creates a choppy experience for users. The following attributes are CuneiFox's way to override this behaviour and submit a form without refreshing the page:
* '''post_route''' ''(url_for_string)''
* '''post_route''' ''(url_for_string: defaults to {{code|lang=python|False}})'': Route to send non-refreshing submit request.
* '''redirect''' ''(bool)''
* '''redirect''' ''(bool: {{code|lang=python|True}} when {{code|post_route}} is given, {{code|lang=python|False}} otherwise)'': Whether the form submission will lead to a page refresh. This value is mainly for use in internal logic and hardly ever demands outside tampering.


Sometimes, a form submission is followed by a long, thread-based operation. More attributes are needed to dictate the thread-tracking behaviours.
Sometimes, a form submission is followed by a long, thread-based operation. More attributes are needed to dictate the thread-tracking behaviours.
* '''wait_long_process''' ''(bool)''
* '''wait_long_process''' ''(bool: defaults to {{code|lang=python|False}})'': Whether the form submission triggers a long thread-based process (e.g. report prompt form).
* '''track_route''' ''(url_for_string)''
* '''track_route''' ''(url_for_string: defaults to {{code|lang=python|False}} if {{code|wait_long_process}} is not given, defaults to {{code|lang=python|'/task_track'}} otherwise)'': Route to send task-tracking request.
* '''wait_redirect''' ''(url_for_string)''
* '''wait_redirect''' ''(url_for_string: defaults to {{code|lang=python|False}})'': Route to redirect to when the long-process associated with the form is completed.


== Design & Pre-made Scripts ==
== Design & Pre-made Scripts ==