.\" This man page is automatically generated using .\" kayadoc2man from the Kaya development tools and the -xmldocs compile .\" option. Editing it directly is not encouraged. .\" It is under the same license as the source .k file that it was .\" generated from. .TH "Webapp.autoFill" "3kaya" "August 2014" "Kaya" "Kaya module reference" .SH "NAME" Webapp::autoFill \- Automatically fill a HTML form .SH "SYNOPSIS" .B Void autoFill( \fIElementTree form, DataSource mainvars, Dict extravars=Dict::new()\fP .B ")" .SH "ARGUMENTS" .PP .B "form" The form element (or a subset of that if you only wish to automatically fill a part of the form. .PP .B "mainvars" The data source to use (e.g. \fBDataPost \fP ) .PP .B "extravars" An optional dictionary mapping keys to lists of values, to allow a form to be automatically filled from a database. You may or may not need to use \fBDataNone \fP as your main data source in this case. .SH "DESCRIPTION" .PP Automatically fill a HTML form based on data from a particular data source. This makes it easy to construct web forms with error handling - see .UR "http://kayalang.org/tutorial/web/webapp" the webapp tutorial .UE for more information. .IP "" -4 ElementTree OnHello(Int dummy) { div = anonymousBlock; // we create this temporarily. fname = incomingValue("fname",DataPost); lname = incomingValue("lname",DataPost); if (fname != "" && lname != "") { p = addParagraph(div,"Hello "+fname+" "+lname); return p; } else { form = HelloForm(); // if they entered one of first and last name, make sure it's still in the form autoFill(form,DataPost); return form; } } ElementTree helloForm() { parent = anonymousBlock; form = addLocalForm(parent); f1 = addFieldset(form,"Who are you?"); input = addLabelledInput(f1,"Your First Name",InputText,"fname","",0); input = addLabelledInput(f1,"Your Last Name",InputText,"lname","",0); submit = addLocalControlInput(f1,"Say hello",OnHello,1); return form; } .SH "AUTHORS" Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/ .SH LICENSE The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation. .SH "RELATED" .PD 0 .PP .B "WebCommon.DataSource"(3kaya) .PD 0.4v