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

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

เพิ่มขึ้น 1,559 ไบต์ ,  8 เมษายน 2567
บรรทัดที่ 137: บรรทัดที่ 137:


== Initiate ==
== Initiate ==
Form initiation create an object instance for a CuneiForm. It should be noted that CuneiFox '''does not''' override the original {{code|lang=python|__init__}} of Flask_WTF's FlaskForm, but has written its own {{code|init_form}} class method which calls the original {{code|lang=python|__init__}} and performs other facilitating routines.
'''{{code|lang=python|1= init_form(cl, prefix="", form_name="", gen_del=None, has_files=False, **kwargs)}}'''
{| style="margin-left:20px;"
|- style="vertical-align:top;"
| style="width:120px;" | '''Parameters''' ||
* '''prefix''' ''(str)'': This value is reflected in FlaskForm's {{code|_prefix}} and CuneiForm's {{code|_id}} attributes during initiation. The {{code|_prefix}} attribute is not directly accessed if one follows the usual coding pattern of CuneiFox.
* '''form_name''' ''(str or LazyString)'': The human-readable form name. This is very rarely accessed (examples include Permission forms and Setting Forms which require the form names to be explicitly and dynamically rendered on the client-side) and usually omitted.
* ''' gen_del''': The way CuneiFox handles data input and data deletion requires fields named '''submit''' ''(SubmitField)'', '''del_submit''' ''(SubmitField)'', and '''is_del''' ''(BooleanField)'' to be present in most of the forms.<br>So, CuneiFox allows developers to define a form with these 3 fields omitted, then provide a not-None argument in this position to automatically create said fields.
|- style="vertical-align:top;"
| '''Returns''' || A new FlaskForm-CuneiFox object.
|}


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