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

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

เพิ่มขึ้น 1,461 ไบต์ ,  13 เมษายน 2567
บรรทัดที่ 528: บรรทัดที่ 528:
=== General Form Tail ===
=== General Form Tail ===
At this point, the {{code|form_obj}} has been initiated, all fields and relevant elements are created; it is time to finalize the {{code|form_obj}} attributes and link all the form elements together.
At this point, the {{code|form_obj}} has been initiated, all fields and relevant elements are created; it is time to finalize the {{code|form_obj}} attributes and link all the form elements together.
'''{{code|lang=javascript|1= general_form_tail(form, populate=true, pack_del=false)}}'''
{| style="margin-left:20px;"
|- style="vertical-align:top;"
| style="width:120px;" | '''Parameters''' ||
* '''form''' ''(FlaskForm-CuneiForm)''
* '''populate''' ''(bool)'': Whether to send an immediate data request to the server.
** ''For single-form pages'', the form populated (besides the default values embedded in the CuneiForm instance itself) here as a sub-routine of {{code|general_form_tail}}.
** ''For [[Multi-component Page|multi-component pages]]'', however, the mass-populating routine is further down (after all tables and forms are created). So, this value should be set to {{code|lang=javascript|false}}.
* '''pack_del''' ''(bool)'': Whether this form has a ''submit as delete functionality'' (with ''del_submit'' and ''is_del'' fields) in addition to a ''normal submit mode''. (See [[#Submit-delete Field Set]].)
|}
The workings of this macro can be thus summarized:
# '''Process the form's ''populate_id'' attribute'''
#* Interpret and repack each string value into a more easily usable format.
#* Where applicable, bind a ''change'' event to the referenced fields so that they trigger a form re-populating routine when changes are detected.
# '''Finalize ''References to DOM Elements & Objects'' and ''Field State & Type Attributes'' families of {{code|form_obj}} attributes.'''
# '''Bind events to form fields, adjacent buttons, and image boxes'''


== Notable Features & Sub-routines ==
== Notable Features & Sub-routines ==