1,801
การแก้ไข
| บรรทัดที่ 693: | บรรทัดที่ 693: | ||
==== Non-redirecting Form ==== | ==== Non-redirecting Form ==== | ||
Non-redirecting form is CuneiFox's way to create a smooth user experience especially when users are expected to interact with pages with multiple forms/tables on a regular basis. The pre-submission routine is not much different form that of redirecting form, the bulk of the routine, however, lies in the post-submission routine. | |||
Below is the rough step-by-step explanation of the routine: | |||
* '''''Pre-submission''''' | |||
*# If any of the flags '''populating''', '''search_filling''', or '''proceeding''' are active, put the submission routine in the queue via flag '''waiting_to_submit'''. The queue is automatically handled when the obstructing flags are flipped back. | |||
*# Send a time-check request to verify the session time and the page time match. ''This action is performed by blocking the submit, performing a time check, and only calling the submission routine again afterward if the check passes. (During the process, the flag '''pass_timechk''' is utilized.)'' | |||
*# Recheck whether any instacalc/search field needs to be re-fetched by checking the field attribute '''valchanged''' of each. Perform the action if necessary. | |||
*# If there is another submission routine running (checked via attribute '''submitting'''), immediate stop the redundant routine. | |||
*# Unformat all special-type fields and clear all search modals. | |||
*# Send an AJAX POST form-submit request. | |||
* '''''Post-submission''''': Process what to do next based on pre-defined form attributes and the {{code|data}} returned from the server. | |||
*# If the server demands redirection to another route ('''{{code|data.redirect}}''') or reload of the same page ('''{{code|data.reload}}'''), do so and end the submission routine. | |||
*# If the server demands a new tab to open a new route ('''{{code|data.new_tab}}'''), do so before continuing. | |||
*# ''(Only applies when the submission fails FlaskForm validation on the server-side)'' Render field error messages packed in '''{{code|data.err}}'''. | |||
*# Render flash messages packed in '''{{code|data.flash_messages}}'''. | |||
*# This step is split into 3 paths: | |||
*#* The submission '''triggers a thread-based process''' on the server ({{code|lang=javascript|1= form_obj.wait_long_process === true}}): | |||
*#*# Disable the submit button to prevent redundant request. | |||
*#*# Initiate a task tracking schedule. | |||
*#* '''The submission fails''' ('''{{code|lang=javascript|1= data.data === 'failure'}}'''), set the page flag '''will_proceed_editmode''' to {{code|lang=javascript|false}}. ''(This flag prevents a multi-component page from proceeding through a failed step.)'' | |||
*#* '''The submission succeeds''' ('''{{code|lang=javascript|1= data.data === 'success'}}'''): | |||
*#*# | |||
{{The Tenko Shrine}} | {{The Tenko Shrine}} | ||