View · Index

Weblog

Filtered by popular tag ad_form, 1 of 1 Postings (all, summary)

Web Forms

Created by Rocael Hernández Rizzardini, last modified by Gustaf Neumann 22 Mar 2019, at 11:21 PM

Use ad_form to create HTML forms. If you work on a page that does not, convert it to use ad_form.

You can grep the toolkit under /packages and see many examples. 

Ad_form can handle many of your possible interactions with the system, such as normal tasks as add and edit data, validate entry form data, etc.

Additional information here:

Rubick on ad_form

Use the following in the tcl part of a page to limit access to page requests via post.. to reduce vulnerability to url hack and insertion attacks from web:

if { [ad_conn method] ne "POST" } {
  ad_script_abort
 }

Grouping elements into sections using ad_form

 

The {-section} list allows to group the subsequent elements (until the next section declaration) into a section. {-section} accepts 4 properties:

 

{-section
	section_id
	{legendtext $legendstring}
	{legend {name value name value ... name value}}
	{fieldset {name value name value ... name value}}
}

where:

  • section_id: a string to identify the section (mandatory)
  • legendtext (optional) a string for the legend of the fieldset (section)
  • legend (optional) a list of name value pairs attributes for the LEGEND tag
  • fieldset (optional) a list of name value pairs attributes for the FIELDSET tag

Example

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ad_form \
	-name "your_zen_level" \
	-method post -html {enctype multipart/form-data class margin-form} \
	-fieldset {{title "T1" class "C1"} "This really works!!"} \ 	-form {      # Start section 1     {-section "sec1" {legendtext "Section Title I"} {legend {class myClass id myId}}}
    {zen_comment:text(comment)\
                 {label "template::widget::comment"}\
                 {value "Please enter your comments."}\
                 {html {rows 7 cols 50}}}
    {zen_file:text(file),optional\
                 {label "template::widget::file"}}

    # Start section2
    {-section "sec2" {legendtext "Section Title II"} {fieldset {class myclass}}}
    {zen_multiselect:text(multiselect)\
                 {label "template::widget::multiselect"}\
                 {options {"mark" "emma" "avni" "carl" "don"}}}

    # Unset the section. subsequent elements will not be in any section.
    {-section ""}
    {zen_text:text(text),optional,nospell\
                 {label "template::widget::text"}\
                 {help_text {"Your identification tag number"}}}
    {zen_textarea:text(textarea),optional,nospell\
                 {label "template::widget::textarea"}\
                 {help_text {"Please describe your desired state of being"}}\
                 {html {rows 7 cols 50}}}
}

 

previous November 2024
Sun Mon Tue Wed Thu Fri Sat
27 28 29 30 31 1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Popular tags

17 , 5.10 , 5.10.0 , 5.10.1 , 5.9.0 , 5.9.1 , ad_form , ADP , ajax , aolserver , asynchronous , bgdelivery , bootstrap , bugtracker , CentOS , COMET , compatibility , CSP , CSRF , cvs , debian , docker , docker-compose , emacs , engineering-standards , exec , fedora , FreeBSD , guidelines , host-node-map
No registered users in community xowiki
in last 30 minutes
Contributors

OpenACS.org