cvs: peardoc /ja/package/html html-quickform.xml /ja/package/html/html-quickform tutorial.xml
| From: | Haruki Setoyama | Date: | Wed, 13 Oct 2004 10:39:43 +0000 |
| Subject: | cvs: peardoc /ja/package/html html-quickform.xml /ja/package/html/html-quickform tutorial.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-4958@lists.php.net to get a copy of this message | ||
haruki Wed Oct 13 06:39:43 2004 EDT
Added files:
/peardoc/ja/package/html html-quickform.xml
/peardoc/ja/package/html/html-quickform tutorial.xml
Log:
new to Ja
http://cvs.php.net/co.php/peardoc/ja/package/html/html-quickform.xml?r=1.1&p=1 Index: peardoc/ja/package/html/html-quickform.xml +++ peardoc/ja/package/html/html-quickform.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.20 Maintainer: haruki Status: ready --> <sect1 id="package.html.html-quickform"> <title>HTML_QuickForm</title> <para> PEAR::HTML_QuickForm ããã±ã¼ã¸ã¯ãHTML ãã©ã¼ã ã®çæãæ¤è¨¼ããã³å¦çãè¡ãã¡ã½ãããæä¾ãã¾ãã </para> <sect2 id="package.html.html-quickform.introduction"> <title>ã¤ã³ãããã¯ã·ã§ã³</title> <para> HTML_QuickForm ã¯ãHTML ãã©ã¼ã ã便å©ã«æ±ãããã®ã©ã¤ãã©ãªã§ãã Javascript ãããã¯ãµã¼ããµã¤ãã§ã®æ¤è¨¼ãè¡ãã¾ããã ãããããªæ¹æ³ã§ã«ã¹ã¿ãã¤ãºãæ¡å¼µãå¯è½ã§ãã HTML_QuickForm ã¯ãè¤æ°ã®ãã¡ã¤ã«ããæ§æããã¦ãã¾ãã ä¸å¿ã¨ãªããã¡ã¤ã«ã¯ã<filename class="directory">pear/HTML</filename> ãã£ã¬ã¯ããªã«ã¤ã³ã¹ãã¼ã«ããã <filename>QuickForm.php</filename> ã§ãã ä»ã«éè¦ãªãã¡ã¤ã«ã¨ãã¦ã¯ããã©ã¼ã è¦ç´ ã«é¢é£ããã¡ã½ãããè¨è¿°ããã <filename>element.php</filename> ãã¡ã¤ã«ããè¦ç´ ã°ã«ã¼ããæ±ãã¡ã½ãããæ¸ããã <filename>group.php</filename> ãã¡ã¤ã«ãæãããã¾ããã©ã¡ãããä»ã®ãªãã¸ã§ã¯ãã¨åæ§ã«ã <filename class="directory">HTML/QuickForm</filename> ãã£ã¬ã¯ããªã«ããã¾ãã <filename>input.php</filename> ã«ã¯ã(text, password çã®) å ¥åå¯è½ãªã¿ã¤ãã®ãã¹ã¦ã®è¦ç´ ã® å ±éã¯ã©ã¹ãè¨è¿°ããã¦ãã¾ããHTML_QuickForm ã«ã¯ãselect, text, password, checkbox, file, submit, reset, button, image, radio, hidden, textarea ã¨ãã£ã æ¨æºçãªãã©ã¼ã è¦ç´ ã®ããããã«å¯¾å¿ãããªãã¸ã§ã¯ããå®ç¾©ããã¦ãã¾ãã ããã«ãAPIãåè´ãããã°ãç¬èªã®è¦ç´ ãä½ããã¨ãå¯è½ã§ãã </para> &package.html.html-quickform.tutorial; &package.html.html-quickform.intro-faq; &package.html.html-quickform.intro-elements; &package.html.html-quickform.intro-migration32; </sect2> <sect2 id="package.html.html-quickform.basic-form"> <title>åºæ¬çãªãã©ã¼ã ã®çæ</title> <para> To be written. </para> &package.html.html-quickform.html-quickform.html-quickform; &package.html.html-quickform.html-quickform.addelement; &package.html.html-quickform.html-quickform.apiversion; &package.html.html-quickform.html-quickform.createelement; &package.html.html-quickform.html-quickform.elementexists; &package.html.html-quickform.html-quickform.errormessage; &package.html.html-quickform.html-quickform.getelementtype; &package.html.html-quickform.html-quickform.getelement; &package.html.html-quickform.html-quickform.getmaxfilesize; &package.html.html-quickform.html-quickform.getregisteredtypes; &package.html.html-quickform.html-quickform.iserror; &package.html.html-quickform.html-quickform.istyperegistered; &package.html.html-quickform.html-quickform.registerelementtype; &package.html.html-quickform.html-quickform.removeelement; &package.html.html-quickform.html-quickform.setmaxfilesize; &package.html.html-quickform.html-quickform.updateelementattr; </sect2> <sect2 id="package.html.html-quickform.elements"> <title>ãã©ã¼ã è¦ç´ ã表ç¾ããã¯ã©ã¹ç¾¤</title> <para> To be written </para> <sect3 id="package.html.html-quickform.elements.base"> <title>Base classes</title> &package.html.html-quickform.html-quickform-element; &package.html.html-quickform.html-quickform-element.html-quickform-element; &package.html.html-quickform.html-quickform-element.accept; &package.html.html-quickform.html-quickform-element.apiversion; &package.html.html-quickform.html-quickform-element.exportvalue; &package.html.html-quickform.html-quickform-element.freeze; &package.html.html-quickform.html-quickform-element.getfrozenhtml; &package.html.html-quickform.html-quickform-element.getlabel; &package.html.html-quickform.html-quickform-element.getname; &package.html.html-quickform.html-quickform-element.gettype; &package.html.html-quickform.html-quickform-element.getvalue; &package.html.html-quickform.html-quickform-element.isfrozen; &package.html.html-quickform.html-quickform-element.onquickformevent; &package.html.html-quickform.html-quickform-element.setlabel; &package.html.html-quickform.html-quickform-element.setname; &package.html.html-quickform.html-quickform-element.setpersistantfreeze; &package.html.html-quickform.html-quickform-element.setvalue; &package.html.html-quickform.html-quickform-input; &package.html.html-quickform.html-quickform-input.html-quickform-input; &package.html.html-quickform.html-quickform-input.settype; </sect3> <sect3 id="package.html.html-quickform.elements.standard"> <title>æ¨æºç HTML è¦ç´ </title> &package.html.html-quickform.html-quickform-button; &package.html.html-quickform.html-quickform-button.html-quickform-button; &package.html.html-quickform.html-quickform-checkbox; &package.html.html-quickform.html-quickform-checkbox.html-quickform-checkbox; &package.html.html-quickform.html-quickform-checkbox.getchecked; &package.html.html-quickform.html-quickform-checkbox.gettext; &package.html.html-quickform.html-quickform-checkbox.setchecked; &package.html.html-quickform.html-quickform-checkbox.settext; &package.html.html-quickform.html-quickform-file; &package.html.html-quickform.html-quickform-file.html-quickform-file; &package.html.html-quickform.html-quickform-file.getsize; &package.html.html-quickform.html-quickform-file.getvalue; &package.html.html-quickform.html-quickform-file.isuploadedfile; &package.html.html-quickform.html-quickform-file.moveuploadedfile; &package.html.html-quickform.html-quickform-file.setsize; &package.html.html-quickform.html-quickform-hidden; &package.html.html-quickform.html-quickform-hidden.html-quickform-hidden; &package.html.html-quickform.html-quickform-image; &package.html.html-quickform.html-quickform-image.html-quickform-image; &package.html.html-quickform.html-quickform-image.setalign; &package.html.html-quickform.html-quickform-image.setborder; &package.html.html-quickform.html-quickform-image.setsource; &package.html.html-quickform.html-quickform-password; &package.html.html-quickform.html-quickform-password.html-quickform-password; &package.html.html-quickform.html-quickform-password.setmaxlength; &package.html.html-quickform.html-quickform-password.setsize; &package.html.html-quickform.html-quickform-radio; &package.html.html-quickform.html-quickform-radio.html-quickform-radio; &package.html.html-quickform.html-quickform-radio.getchecked; &package.html.html-quickform.html-quickform-radio.gettext; &package.html.html-quickform.html-quickform-radio.setchecked; &package.html.html-quickform.html-quickform-radio.settext; &package.html.html-quickform.html-quickform-reset; &package.html.html-quickform.html-quickform-reset.html-quickform-reset; &package.html.html-quickform.html-quickform-select; &package.html.html-quickform.html-quickform-select.html-quickform-select; &package.html.html-quickform.html-quickform-select.addoption; &package.html.html-quickform.html-quickform-select.getmultiple; &package.html.html-quickform.html-quickform-select.getprivatename; &package.html.html-quickform.html-quickform-select.getselected; &package.html.html-quickform.html-quickform-select.getsize; &package.html.html-quickform.html-quickform-select.load; &package.html.html-quickform.html-quickform-select.loadarray; &package.html.html-quickform.html-quickform-select.loaddbresult; &package.html.html-quickform.html-quickform-select.loadquery; &package.html.html-quickform.html-quickform-select.setmultiple; &package.html.html-quickform.html-quickform-select.setselected; &package.html.html-quickform.html-quickform-select.setsize; &package.html.html-quickform.html-quickform-submit; &package.html.html-quickform.html-quickform-submit.html-quickform-submit; &package.html.html-quickform.html-quickform-text; &package.html.html-quickform.html-quickform-text.html-quickform-text; &package.html.html-quickform.html-quickform-text.setmaxlength; &package.html.html-quickform.html-quickform-text.setsize; &package.html.html-quickform.html-quickform-textarea; &package.html.html-quickform.html-quickform-textarea.html-quickform-textarea; &package.html.html-quickform.html-quickform-textarea.setcols; &package.html.html-quickform.html-quickform-textarea.setrows; &package.html.html-quickform.html-quickform-textarea.setwrap; </sect3> <sect3 id="package.html.html-quickform.elements.custom"> <title>ã«ã¹ã¿ã è¦ç´ </title> &package.html.html-quickform.html-quickform-advcheckbox; &package.html.html-quickform.html-quickform-advcheckbox.html-quickform-advcheckbox; &package.html.html-quickform.html-quickform-advcheckbox.getonclickjs; &package.html.html-quickform.html-quickform-advcheckbox.getprivatename; &package.html.html-quickform.html-quickform-advcheckbox.setvalues; &package.html.html-quickform.html-quickform-autocomplete; &package.html.html-quickform.html-quickform-autocomplete.html-quickform-autocomplete; &package.html.html-quickform.html-quickform-autocomplete.setoptions; &package.html.html-quickform.html-quickform-date; &package.html.html-quickform.html-quickform-date.html-quickform-date; &package.html.html-quickform.html-quickform-header; &package.html.html-quickform.html-quickform-header.html-quickform-header; &package.html.html-quickform.html-quickform-hiddenselect; &package.html.html-quickform.html-quickform-hiddenselect.html-quickform-hiddenselect; &package.html.html-quickform.html-quickform-hierselect; &package.html.html-quickform.html-quickform-hierselect.html-quickform-hierselect; &package.html.html-quickform.html-quickform-hierselect.setmainoptions; &package.html.html-quickform.html-quickform-hierselect.setsecoptions; &package.html.html-quickform.html-quickform-html; &package.html.html-quickform.html-quickform-html.html-quickform-html; &package.html.html-quickform.html-quickform-link; &package.html.html-quickform.html-quickform-link.html-quickform-link; &package.html.html-quickform.html-quickform-link.sethref; &package.html.html-quickform.html-quickform-static; &package.html.html-quickform.html-quickform-static.html-quickform-static; &package.html.html-quickform.html-quickform-static.settext; </sect3> </sect2> <sect2 id="package.html.html-quickform.groups"> <title>ã°ã«ã¼ãã®ä½¿ç¨</title> <para> To be written. </para> &package.html.html-quickform.html-quickform.addgroup; &package.html.html-quickform.html-quickform-group; &package.html.html-quickform.html-quickform-group.html-quickform-group; &package.html.html-quickform.html-quickform-group.getelementname; &package.html.html-quickform.html-quickform-group.getelements; &package.html.html-quickform.html-quickform-group.getgrouptype; &package.html.html-quickform.html-quickform-group.setelements; </sect2> <sect2 id="package.html.html-quickform.values"> <title>è¦ç´ å¤ã®å¦ç</title> <para> åè¦ç´ ã®å¤ã管çããå ¥åãããå¤ãå¦çããã¡ã½ããã§ãã </para> <sect3 id="package.html.html-quickform.values.getting-setting"> <title>è¦ç´ å¤ã®åå¾ãè¨å®ããã³å¦ç</title> &package.html.html-quickform.html-quickform.setconstants; &package.html.html-quickform.html-quickform.setdefaults; &package.html.html-quickform.html-quickform.exportvalue; &package.html.html-quickform.html-quickform.exportvalues; &package.html.html-quickform.html-quickform.getelementvalue; &package.html.html-quickform.html-quickform.getsubmitvalue; &package.html.html-quickform.html-quickform.getsubmitvalues; &package.html.html-quickform.html-quickform.process; </sect3> <sect3 id="package.html.html-quickform.values.validation"> <title>æ¤è¨¼ããã³ãã£ã«ã¿</title> <para> HTML_QuickForm ã¯ããæ¤è¨¼ã«ã¼ã«ãããµãã¼ããã¦ãã¾ãã èªãã®æ¤è¨¼ã«ã¼ã«ãæ¸ããQuickForm ã«ç»é²ããå¾ãèªèº«ã®ã¹ã¯ãªããããã³ã¼ã«ãã¾ãã ããã©ã«ãã§ã¯ãæ£è¦è¡¨ç¾ã«ããæ¤è¨¼ï¼<ulink url="&url.php.lookup;preg-match">preg_match</ulink> å½¢å¼ï¼ ããæ¤è¨¼ãè¦æ±ãããè¦ç´ ã«ã¤ãã¦ã®ã¿è¡ããã¾ãã ã¾ããã¯ã©ã¤ã¢ã³ãå´ã§ã®æ¤è¨¼ãè¡ãããå ´åã¯ãå¿ è¦ãª javascript ã³ã¼ããçæããã¾ãã ãµã¼ãå´ã§ã®æ¤è¨¼ã¯ï¼ããã©ã«ãã§ã¯ï¼å¸¸ã«è¡ããã¾ãã </para> <para> ãã©ã¼ã ã¸ã®ãã¼ã¿ã®ã¤ã³ãã¼ãããéä¿¡ããããã©ã¼ã ã®å¦çã«éãã¦ããã£ã«ã¿ãå©ç¨ãããã¨ãã§ãã¾ãã ãã£ã«ã¿ã¯ãæåã«ç»é²ã®å¿ è¦ããªããã¨ãé¤ããæ¤è¨¼ã«ã¼ã«ã¨åæ§ã«åä½ãã¾ãã ãã£ã«ã¿é¢æ°ãæ¸ããã¹ã¯ãªããããã³ã¼ã«ãã¾ãã (trim, addslashes, htmlentities, ãªã©ã®) ãã¹ã¦ã® PHP 颿°ã使ç¨ã§ãã¾ãããè¦ç´ å¤ã¸å帰çã«é©ç¨ããã¾ãã </para> &package.html.html-quickform.intro-validation; &package.html.html-quickform.html-quickform.addrule; &package.html.html-quickform.html-quickform.addgrouprule; &package.html.html-quickform.html-quickform.addformrule; &package.html.html-quickform.html-quickform.iselementrequired; &package.html.html-quickform.html-quickform.validate; &package.html.html-quickform.html-quickform.getelementerror; &package.html.html-quickform.html-quickform.setelementerror; &package.html.html-quickform.html-quickform.registerrule; &package.html.html-quickform.html-quickform.getregisteredrules; &package.html.html-quickform.html-quickform.isruleregistered; &package.html.html-quickform.html-quickform.applyfilter; </sect3> </sect2> <sect2 id="package.html.html-quickform.output"> <title>ãã©ã¼ã ã®åºå</title> <para> HTML_QuickForm ã¯ããããããªç¨®é¡ã®ã¬ã³ãã©ã®ä½¿ç¨ãå¯è½ã§ãã®ã§ã ãã©ã¼ã ã®åºåãæ§ã ã«ã«ã¹ã¿ãã¤ãºãããã¨ãã§ãã¾ãã ããã©ã«ãã®ã¬ã³ãã©ã使ãã°ãåè¦ç´ ã®å±æ§å¤ãã¨ã©ã¼ã¡ãã»ã¼ã¸ã»ãããã»å¿ é å ¥åæ¬ã®è¡¨ç¤ºã¨ãã£ãç¹ã ã«ã¹ã¿ãã¤ãºã§ãã¾ãããç¬èªã®ã¬ã³ãã©ãæ¸ããã¨ãå¯è½ã§ãã </para> <sect3 id="package.html.html-quickform.output.form-customization"> <title>ãã©ã¼ã ã®ã«ã¹ã¿ãã¤ãºã¨åºåãã«ãã¼</title> &package.html.html-quickform.html-quickform.freeze; &package.html.html-quickform.html-quickform.iselementfrozen; &package.html.html-quickform.html-quickform.isfrozen; &package.html.html-quickform.html-quickform.setrequirednote; &package.html.html-quickform.html-quickform.setjswarnings; &package.html.html-quickform.html-quickform.getrequirednote; &package.html.html-quickform.html-quickform.getvalidationscript; &package.html.html-quickform.html-quickform.accept; &package.html.html-quickform.html-quickform.defaultrenderer; &package.html.html-quickform.html-quickform.toarray; &package.html.html-quickform.html-quickform.tohtml; </sect3> <sect3 id="package.html.html-quickform.output.basic-renderers"> <title>åºæ¬çãªã¬ã³ãã©</title> <para> ãããã®ã¬ã³ãã©ã¯ããã¼ã¸ã§ã³3.0以åã® <classname>HTML_QuickForm</classname> ã³ã¼ãã åºç¤ã¨ãã¦ãããåä½ã«ä»ã®ã¯ã©ã¹ãå¿ è¦ã¨ãã¾ããã </para> &package.html.html-quickform.intro-renderers; &package.html.html-quickform.html-quickform-renderer-default; &package.html.html-quickform.html-quickform-renderer-default.clearalltemplates; &package.html.html-quickform.html-quickform-renderer-default.setelementtemplate; &package.html.html-quickform.html-quickform-renderer-default.setformtemplate; &package.html.html-quickform.html-quickform-renderer-default.setgroupelementtemplate; &package.html.html-quickform.html-quickform-renderer-default.setgrouptemplate; &package.html.html-quickform.html-quickform-renderer-default.setheadertemplate; &package.html.html-quickform.html-quickform-renderer-default.setrequirednotetemplate; &package.html.html-quickform.html-quickform-renderer-default.tohtml; &package.html.html-quickform.html-quickform-renderer-array; &package.html.html-quickform.html-quickform-renderer-array.html-quickform-renderer-array; &package.html.html-quickform.html-quickform-renderer-array.setelementstyle; &package.html.html-quickform.html-quickform-renderer-array.toarray; </sect3> <sect3 id="package.html.html-quickform.output.template-renderers"> <title>ãã³ãã¬ã¼ããã¼ã¹ã®ã¬ã³ãã©</title> <para> ãããã®ã¬ã³ãã©ã¯ããã©ã¼ã ã® HTML åºåã®çæã«ãã³ãã¬ã¼ãã¨ã³ã¸ã³ã使ç¨ãã¾ãã </para> &package.html.html-quickform.html-quickform-renderer-arraysmarty; &package.html.html-quickform.html-quickform-renderer-arraysmarty.html-quickform-renderer-arraysmarty; &package.html.html-quickform.html-quickform-renderer-arraysmarty.seterrortemplate; &package.html.html-quickform.html-quickform-renderer-arraysmarty.setrequiredtemplate; &package.html.html-quickform.html-quickform-renderer-itdynamic; &package.html.html-quickform.html-quickform-renderer-itdynamic.html-quickform-renderer-itdynamic; &package.html.html-quickform.html-quickform-renderer-itdynamic.setelementblock; &package.html.html-quickform.html-quickform-renderer-itdynamic.setheaderblock; &package.html.html-quickform.html-quickform-renderer-itstatic; &package.html.html-quickform.html-quickform-renderer-itstatic.html-quickform-renderer-itstatic; &package.html.html-quickform.html-quickform-renderer-itstatic.seterrortemplate; &package.html.html-quickform.html-quickform-renderer-itstatic.setrequiredtemplate; &package.html.html-quickform.html-quickform-renderer-quickhtml; &package.html.html-quickform.html-quickform-renderer-quickhtml.html-quickform-renderer-quickhtml; &package.html.html-quickform.html-quickform-renderer-quickhtml.tohtml; &package.html.html-quickform.html-quickform-renderer-quickhtml.elementtohtml; </sect3> <sect3 id="package.html.html-quickform.output.renderer-doc"> <title>ã¬ã³ãã©ã®ã¤ã³ãã©ã¹ãã©ã¯ãã£</title> <para> æ¢åã®ã¬ã³ãã©ãæ¡å¼µããããæ°ããã¬ã³ãã©ãæ¸ãå ´åã«ã¯ã以ä¸ãåèã¨ãªãã§ãããã </para> &package.html.html-quickform.html-quickform-renderer; &package.html.html-quickform.html-quickform-renderer.startform; &package.html.html-quickform.html-quickform-renderer.finishform; &package.html.html-quickform.html-quickform-renderer.startgroup; &package.html.html-quickform.html-quickform-renderer.finishgroup; &package.html.html-quickform.html-quickform-renderer.renderelement; &package.html.html-quickform.html-quickform-renderer.renderheader; &package.html.html-quickform.html-quickform-renderer.renderhidden; &package.html.html-quickform.html-quickform-renderer.renderhtml; </sect3> </sect2> </sect1> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/ja/package/html/html-quickform/tutorial.xml?r=1.1&p=1 Index: peardoc/ja/package/html/html-quickform/tutorial.xml +++ peardoc/ja/package/html/html-quickform/tutorial.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: haruki Status: partial --> <refentry id="package.html.html-quickform.tutorial"> <refnamediv> <refname>ã¯ã¤ãã¯ã¹ã¿ã¼ãã¬ã¤ã</refname> <refpurpose>HTML_QuickForm ãã¥ã¼ããªã¢ã«</refpurpose> </refnamediv> <refsect1 id="package.html.html-quickform.tutorial.purpose"> <title>ã¤ã³ãããã¯ã·ã§ã³</title> <para> ãã®ãã¥ã¼ããªã¢ã«ã¯ãQuickForm ãåãã¦ä½¿ãã¦ã¼ã¶ã«å¯¾ãã¦ã æ©è½ã¨ä½¿ç¨æ³ã®æ¦è¦ãç´¹ä»ãããã®ã§ãã ããã§ã¯ãå©ç¨ã§ããæ©è½ã®å ã®ã»ãã®ä¸é¨ã ãã«ã¤ãã¦è§£èª¬ãã¾ããã ããåºãæ·±ãç¥ãããã«æ¬ããã¥ã¢ã«ã®ã©ããè¦ãã°è¯ããã«ã¤ãã¦ã示ãã¦ããã¾ãã </para> <para> Keith Edmunds ã«ãã£ã¦æ¸ããããQuickForm ã®ä½¿ç¨æ³ã«ã¤ãã¦ã® <ulink url="http://www.thelinuxconsultancy.co.uk/quickform.html">ããã¶ãé·ãã®ãã¥ã¼ããªã¢ã«</ulink> ãåèã¨ãªãã§ãããã </para> </refsect1> <refsect1 id="package.html.html-quickform.tutorial.firstform"> <title>ã¯ããã¦ã®ãã©ã¼ã </title> <example> <title>åºæ¬çãªä½¿ç¨æ¹æ³</title> <programlisting role="php"> <![CDATA[ // ã¡ã¤ã³ã¯ã©ã¹ã®èªã¿è¾¼ã¿ require_once 'HTML/QuickForm.php'; // HTML_QuickForm ãªãã¸ã§ã¯ããçæ $form = new HTML_QuickForm('firstForm'); // ãã©ã¼ã è¦ç´ ã®ããã©ã«ãå¤ãè¨å® $form->setDefaults(array( 'name' => 'Joe User' )); // ãã©ã¼ã ã«è¦ç´ ãããã¤ã追å $form->addElement('header', null, 'QuickForm tutorial example'); $form->addElement('text', 'name', 'Enter your name:', array('size' => 50, 'maxlength' => 255)); $form->addElement('submit', null, 'Send'); // ãã£ã«ã¿ã¨æ¤è¨¼ã«ã¼ã«ã追å $form->applyFilter('name', 'trim'); $form->addRule('name', 'Please enter your name', 'required', null, 'client'); // ãã©ã¼ã ã®å¦¥å½æ§æ¤è¨¼ if ($form->validate()) { echo '<h1>Hello, ' . htmlspecialchars($form->exportValue('name')) . '!</h1>'; exit; } // ãã©ã¼ã ã®åºå $form->display(); ]]> </programlisting> </example> <para> ã§ã¯ãé ã追ã£ã¦ä¸è¨ã®ä¾ãæ¤è¨ãã¦è¡ãã¾ãããã </para> <refsect2 id="package.html.html-quickform.tutorial.firstform.building"> <title>ãã©ã¼ã ã®æ§ç¯</title> <para> <programlisting role="php"> <![CDATA[ $form = new HTML_QuickForm('firstForm'); ]]> </programlisting> ã®è¡ã§ãHTML_QuickForm ãªãã¸ã§ã¯ããçæããã¦ãã¾ãã å¾ã§ããã®HTML_QuickForm ãªãã¸ã§ã¯ãã«ãè¦ç´ ã«å¯¾å¿ãããªãã¸ã§ã¯ããä»ã®å¿ è¦ãªæ å ±ãå ãã¦ãããã¨ã¨ãªãã¾ãã ããã§ã<link linkend="package.html.html-quickform.html-quickform.html-quickform">ã³ã³ã¹ãã©ã¯ã¿</link>ã«ã¯ã ãã©ã¼ã ã®åç§°ã®ã¿ã渡ããä»ã®ãã©ã¡ã¼ã¿ã¯ããã©ã«ãå¤ã使ããã¦ãã¾ãã ãã©ã¼ã ã® method 屿§ã«ã¯ <literal>POST</literal> ããaction 屿§ã«ã¯ç¾å¨ã®ãã¡ã¤ã«åã¨ãªãã¾ãã When using QuickForm, it is easier to keep all the form related logic in one file. </para> <para> You might guess that <programlisting role="php"> <![CDATA[ $form->setDefaults(array( 'name' => 'Joe User' )); ]]> </programlisting> sets the default value for <literal>name</literal> element to <literal>'Joe User'</literal>. QuickForm has the concept of default values (set via <link linkend="package.html.html-quickform.html-quickform.setdefaults"><function>setDefaults</function></link> method) and constant ones (set via <link linkend="package.html.html-quickform.html-quickform.setconstants"><function>setConstants</function></link>). The difference between them is that user's input overrides default values but not constant ones. </para> <para> Our form will consist of three elements: <programlisting role="php"> <![CDATA[ $form->addElement('header', null, 'QuickForm tutorial example'); $form->addElement('text', 'name', 'Enter your name:', array('size' => 50, 'maxlength' => 255)); $form->addElement('submit', null, 'Send'); ]]> </programlisting> The first one is not the 'real' element, it is just a heading to improve presentation. The second one actually is a text input box and the third is a submit button. Note that parameters for <link linkend="package.html.html-quickform.html-quickform.addelement"><function>addElement</function></link> method have different meanings for different elements. That is so because they are actually passed to these elements' constructors. </para> </refsect2> <refsect2 id="package.html.html-quickform.tutorial.firstform.checking"> <title>Checking input</title> <para> The line <programlisting role="php"> <![CDATA[ $form->applyFilter('name', 'trim'); ]]> </programlisting> defines a <link linkend="package.html.html-quickform.intro-validation.filters">filter</link> for the 'name' element value - the function that will be applied to it after form submit. In this case it is a builtin <ulink url="&url.php.lookup;trim"><function>trim</function></ulink> function, but can be any valid <ulink url="&url.php.callback;"><type>callback</type></ulink>. Thus we will strip all whitespace from the name, as we do not actually need it and as we want to be sure that a name was entered, not just some spaces. </para> <para> Next we define a <link linkend="package.html.html-quickform.intro-validation.rules">rule</link> for the name field: <programlisting role="php"> <![CDATA[ $form->addRule('name', 'Please enter your name', 'required', null, 'client'); ]]> </programlisting> This means that QuickForm will display an error message if the name was not entered. The <literal>'client'</literal> modifier is here to switch on client-side JavaScript validation in addition to server-side one. Note also that QuickForm will automatically mark required fields in the form. </para> </refsect2> <refsect2 id="package.html.html-quickform.tutorial.firstform.processing"> <title>Validating and processing</title> <para> We now have the form built and rules defined and need to decide whether to process it or display: <programlisting role="php"> <![CDATA[ if ($form->validate()) { // Do some stuff } ]]> </programlisting> The <link linkend="package.html.html-quickform.html-quickform.validate"><function>validate</function></link> method will consider the form valid (i.e. return &true;) if some data was actually submitted and all the rules defined for the form were satisfied. In our case this means that 'name' element was not empty. </para> <para> If the form is validated we need to process the values <programlisting role="php"> <![CDATA[ echo '<h1>Hello, ' . htmlspecialchars($form->exportValue('name')) . '!</h1>'; exit; ]]> </programlisting> This is an example, in your scripts you'll usually want to store the values somewhere and to redirect to some other page to prevent a duplicate submit. The <link linkend="package.html.html-quickform.html-quickform.process"><function>process</function></link> and <link linkend="package.html.html-quickform.html-quickform.exportvalues"><function>exportvalues</function></link> methods may be of interest here. </para> <para> The last line is pretty easy: <programlisting role="php"> <![CDATA[ $form->display(); ]]> </programlisting> If the form is not valid, which means that it either was not yet submitted or that there were errors, it will be displayed. Error messages (if any) will be displayed near the corresponding elements. </para> </refsect2> </refsect1> <refsect1 id="package.html.html-quickform.tutorial.advanced"> <title>Advanced features</title> <para> You now should have an understanding of basic QuickForm functionality, but there are many more features in the package, each of them deserving a separate tutorial. This section will give a short overview of them and point you to the complete documentation. </para> <para> <link linkend="package.html.html-quickform.groups">Groups</link> allow to combine several individual elements into one entity and to use it as one element. This is also used to create pseudo-elements like date and hierselect. </para> <para> QuickForm offers a lot of possibilities to customize form layout and appearance. Form output is done via <link linkend="package.html.html-quickform.intro-renderers">renderers</link> - special classes containing necessary logic. There are renderers that <link linkend="package.html.html-quickform.html-quickform-renderer-default">directly output HTML</link> and those that <link linkend="package.html.html-quickform.output.template-renderers">use template engines</link> for this. </para> <para> And finally, you can extend QuickForm by adding your own element types, rules and <link linkend="package.html.html-quickform.output.renderer-doc">renderers</link>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-executeMultiple-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
http://cvs.php.net/co.php/peardoc/ja/package/html/html-quickform.xml?r=1.1&p=1 Index: peardoc/ja/package/html/html-quickform.xml +++ peardoc/ja/package/html/html-quickform.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.20 Maintainer: haruki Status: ready --> <sect1 id="package.html.html-quickform"> <title>HTML_QuickForm</title> <para> PEAR::HTML_QuickForm ããã±ã¼ã¸ã¯ãHTML ãã©ã¼ã ã®çæãæ¤è¨¼ããã³å¦çãè¡ãã¡ã½ãããæä¾ãã¾ãã </para> <sect2 id="package.html.html-quickform.introduction"> <title>ã¤ã³ãããã¯ã·ã§ã³</title> <para> HTML_QuickForm ã¯ãHTML ãã©ã¼ã ã便å©ã«æ±ãããã®ã©ã¤ãã©ãªã§ãã Javascript ãããã¯ãµã¼ããµã¤ãã§ã®æ¤è¨¼ãè¡ãã¾ããã ãããããªæ¹æ³ã§ã«ã¹ã¿ãã¤ãºãæ¡å¼µãå¯è½ã§ãã HTML_QuickForm ã¯ãè¤æ°ã®ãã¡ã¤ã«ããæ§æããã¦ãã¾ãã ä¸å¿ã¨ãªããã¡ã¤ã«ã¯ã<filename class="directory">pear/HTML</filename> ãã£ã¬ã¯ããªã«ã¤ã³ã¹ãã¼ã«ããã <filename>QuickForm.php</filename> ã§ãã ä»ã«éè¦ãªãã¡ã¤ã«ã¨ãã¦ã¯ããã©ã¼ã è¦ç´ ã«é¢é£ããã¡ã½ãããè¨è¿°ããã <filename>element.php</filename> ãã¡ã¤ã«ããè¦ç´ ã°ã«ã¼ããæ±ãã¡ã½ãããæ¸ããã <filename>group.php</filename> ãã¡ã¤ã«ãæãããã¾ããã©ã¡ãããä»ã®ãªãã¸ã§ã¯ãã¨åæ§ã«ã <filename class="directory">HTML/QuickForm</filename> ãã£ã¬ã¯ããªã«ããã¾ãã <filename>input.php</filename> ã«ã¯ã(text, password çã®) å ¥åå¯è½ãªã¿ã¤ãã®ãã¹ã¦ã®è¦ç´ ã® å ±éã¯ã©ã¹ãè¨è¿°ããã¦ãã¾ããHTML_QuickForm ã«ã¯ãselect, text, password, checkbox, file, submit, reset, button, image, radio, hidden, textarea ã¨ãã£ã æ¨æºçãªãã©ã¼ã è¦ç´ ã®ããããã«å¯¾å¿ãããªãã¸ã§ã¯ããå®ç¾©ããã¦ãã¾ãã ããã«ãAPIãåè´ãããã°ãç¬èªã®è¦ç´ ãä½ããã¨ãå¯è½ã§ãã </para> &package.html.html-quickform.tutorial; &package.html.html-quickform.intro-faq; &package.html.html-quickform.intro-elements; &package.html.html-quickform.intro-migration32; </sect2> <sect2 id="package.html.html-quickform.basic-form"> <title>åºæ¬çãªãã©ã¼ã ã®çæ</title> <para> To be written. </para> &package.html.html-quickform.html-quickform.html-quickform; &package.html.html-quickform.html-quickform.addelement; &package.html.html-quickform.html-quickform.apiversion; &package.html.html-quickform.html-quickform.createelement; &package.html.html-quickform.html-quickform.elementexists; &package.html.html-quickform.html-quickform.errormessage; &package.html.html-quickform.html-quickform.getelementtype; &package.html.html-quickform.html-quickform.getelement; &package.html.html-quickform.html-quickform.getmaxfilesize; &package.html.html-quickform.html-quickform.getregisteredtypes; &package.html.html-quickform.html-quickform.iserror; &package.html.html-quickform.html-quickform.istyperegistered; &package.html.html-quickform.html-quickform.registerelementtype; &package.html.html-quickform.html-quickform.removeelement; &package.html.html-quickform.html-quickform.setmaxfilesize; &package.html.html-quickform.html-quickform.updateelementattr; </sect2> <sect2 id="package.html.html-quickform.elements"> <title>ãã©ã¼ã è¦ç´ ã表ç¾ããã¯ã©ã¹ç¾¤</title> <para> To be written </para> <sect3 id="package.html.html-quickform.elements.base"> <title>Base classes</title> &package.html.html-quickform.html-quickform-element; &package.html.html-quickform.html-quickform-element.html-quickform-element; &package.html.html-quickform.html-quickform-element.accept; &package.html.html-quickform.html-quickform-element.apiversion; &package.html.html-quickform.html-quickform-element.exportvalue; &package.html.html-quickform.html-quickform-element.freeze; &package.html.html-quickform.html-quickform-element.getfrozenhtml; &package.html.html-quickform.html-quickform-element.getlabel; &package.html.html-quickform.html-quickform-element.getname; &package.html.html-quickform.html-quickform-element.gettype; &package.html.html-quickform.html-quickform-element.getvalue; &package.html.html-quickform.html-quickform-element.isfrozen; &package.html.html-quickform.html-quickform-element.onquickformevent; &package.html.html-quickform.html-quickform-element.setlabel; &package.html.html-quickform.html-quickform-element.setname; &package.html.html-quickform.html-quickform-element.setpersistantfreeze; &package.html.html-quickform.html-quickform-element.setvalue; &package.html.html-quickform.html-quickform-input; &package.html.html-quickform.html-quickform-input.html-quickform-input; &package.html.html-quickform.html-quickform-input.settype; </sect3> <sect3 id="package.html.html-quickform.elements.standard"> <title>æ¨æºç HTML è¦ç´ </title> &package.html.html-quickform.html-quickform-button; &package.html.html-quickform.html-quickform-button.html-quickform-button; &package.html.html-quickform.html-quickform-checkbox; &package.html.html-quickform.html-quickform-checkbox.html-quickform-checkbox; &package.html.html-quickform.html-quickform-checkbox.getchecked; &package.html.html-quickform.html-quickform-checkbox.gettext; &package.html.html-quickform.html-quickform-checkbox.setchecked; &package.html.html-quickform.html-quickform-checkbox.settext; &package.html.html-quickform.html-quickform-file; &package.html.html-quickform.html-quickform-file.html-quickform-file; &package.html.html-quickform.html-quickform-file.getsize; &package.html.html-quickform.html-quickform-file.getvalue; &package.html.html-quickform.html-quickform-file.isuploadedfile; &package.html.html-quickform.html-quickform-file.moveuploadedfile; &package.html.html-quickform.html-quickform-file.setsize; &package.html.html-quickform.html-quickform-hidden; &package.html.html-quickform.html-quickform-hidden.html-quickform-hidden; &package.html.html-quickform.html-quickform-image; &package.html.html-quickform.html-quickform-image.html-quickform-image; &package.html.html-quickform.html-quickform-image.setalign; &package.html.html-quickform.html-quickform-image.setborder; &package.html.html-quickform.html-quickform-image.setsource; &package.html.html-quickform.html-quickform-password; &package.html.html-quickform.html-quickform-password.html-quickform-password; &package.html.html-quickform.html-quickform-password.setmaxlength; &package.html.html-quickform.html-quickform-password.setsize; &package.html.html-quickform.html-quickform-radio; &package.html.html-quickform.html-quickform-radio.html-quickform-radio; &package.html.html-quickform.html-quickform-radio.getchecked; &package.html.html-quickform.html-quickform-radio.gettext; &package.html.html-quickform.html-quickform-radio.setchecked; &package.html.html-quickform.html-quickform-radio.settext; &package.html.html-quickform.html-quickform-reset; &package.html.html-quickform.html-quickform-reset.html-quickform-reset; &package.html.html-quickform.html-quickform-select; &package.html.html-quickform.html-quickform-select.html-quickform-select; &package.html.html-quickform.html-quickform-select.addoption; &package.html.html-quickform.html-quickform-select.getmultiple; &package.html.html-quickform.html-quickform-select.getprivatename; &package.html.html-quickform.html-quickform-select.getselected; &package.html.html-quickform.html-quickform-select.getsize; &package.html.html-quickform.html-quickform-select.load; &package.html.html-quickform.html-quickform-select.loadarray; &package.html.html-quickform.html-quickform-select.loaddbresult; &package.html.html-quickform.html-quickform-select.loadquery; &package.html.html-quickform.html-quickform-select.setmultiple; &package.html.html-quickform.html-quickform-select.setselected; &package.html.html-quickform.html-quickform-select.setsize; &package.html.html-quickform.html-quickform-submit; &package.html.html-quickform.html-quickform-submit.html-quickform-submit; &package.html.html-quickform.html-quickform-text; &package.html.html-quickform.html-quickform-text.html-quickform-text; &package.html.html-quickform.html-quickform-text.setmaxlength; &package.html.html-quickform.html-quickform-text.setsize; &package.html.html-quickform.html-quickform-textarea; &package.html.html-quickform.html-quickform-textarea.html-quickform-textarea; &package.html.html-quickform.html-quickform-textarea.setcols; &package.html.html-quickform.html-quickform-textarea.setrows; &package.html.html-quickform.html-quickform-textarea.setwrap; </sect3> <sect3 id="package.html.html-quickform.elements.custom"> <title>ã«ã¹ã¿ã è¦ç´ </title> &package.html.html-quickform.html-quickform-advcheckbox; &package.html.html-quickform.html-quickform-advcheckbox.html-quickform-advcheckbox; &package.html.html-quickform.html-quickform-advcheckbox.getonclickjs; &package.html.html-quickform.html-quickform-advcheckbox.getprivatename; &package.html.html-quickform.html-quickform-advcheckbox.setvalues; &package.html.html-quickform.html-quickform-autocomplete; &package.html.html-quickform.html-quickform-autocomplete.html-quickform-autocomplete; &package.html.html-quickform.html-quickform-autocomplete.setoptions; &package.html.html-quickform.html-quickform-date; &package.html.html-quickform.html-quickform-date.html-quickform-date; &package.html.html-quickform.html-quickform-header; &package.html.html-quickform.html-quickform-header.html-quickform-header; &package.html.html-quickform.html-quickform-hiddenselect; &package.html.html-quickform.html-quickform-hiddenselect.html-quickform-hiddenselect; &package.html.html-quickform.html-quickform-hierselect; &package.html.html-quickform.html-quickform-hierselect.html-quickform-hierselect; &package.html.html-quickform.html-quickform-hierselect.setmainoptions; &package.html.html-quickform.html-quickform-hierselect.setsecoptions; &package.html.html-quickform.html-quickform-html; &package.html.html-quickform.html-quickform-html.html-quickform-html; &package.html.html-quickform.html-quickform-link; &package.html.html-quickform.html-quickform-link.html-quickform-link; &package.html.html-quickform.html-quickform-link.sethref; &package.html.html-quickform.html-quickform-static; &package.html.html-quickform.html-quickform-static.html-quickform-static; &package.html.html-quickform.html-quickform-static.settext; </sect3> </sect2> <sect2 id="package.html.html-quickform.groups"> <title>ã°ã«ã¼ãã®ä½¿ç¨</title> <para> To be written. </para> &package.html.html-quickform.html-quickform.addgroup; &package.html.html-quickform.html-quickform-group; &package.html.html-quickform.html-quickform-group.html-quickform-group; &package.html.html-quickform.html-quickform-group.getelementname; &package.html.html-quickform.html-quickform-group.getelements; &package.html.html-quickform.html-quickform-group.getgrouptype; &package.html.html-quickform.html-quickform-group.setelements; </sect2> <sect2 id="package.html.html-quickform.values"> <title>è¦ç´ å¤ã®å¦ç</title> <para> åè¦ç´ ã®å¤ã管çããå ¥åãããå¤ãå¦çããã¡ã½ããã§ãã </para> <sect3 id="package.html.html-quickform.values.getting-setting"> <title>è¦ç´ å¤ã®åå¾ãè¨å®ããã³å¦ç</title> &package.html.html-quickform.html-quickform.setconstants; &package.html.html-quickform.html-quickform.setdefaults; &package.html.html-quickform.html-quickform.exportvalue; &package.html.html-quickform.html-quickform.exportvalues; &package.html.html-quickform.html-quickform.getelementvalue; &package.html.html-quickform.html-quickform.getsubmitvalue; &package.html.html-quickform.html-quickform.getsubmitvalues; &package.html.html-quickform.html-quickform.process; </sect3> <sect3 id="package.html.html-quickform.values.validation"> <title>æ¤è¨¼ããã³ãã£ã«ã¿</title> <para> HTML_QuickForm ã¯ããæ¤è¨¼ã«ã¼ã«ãããµãã¼ããã¦ãã¾ãã èªãã®æ¤è¨¼ã«ã¼ã«ãæ¸ããQuickForm ã«ç»é²ããå¾ãèªèº«ã®ã¹ã¯ãªããããã³ã¼ã«ãã¾ãã ããã©ã«ãã§ã¯ãæ£è¦è¡¨ç¾ã«ããæ¤è¨¼ï¼<ulink url="&url.php.lookup;preg-match">preg_match</ulink> å½¢å¼ï¼ ããæ¤è¨¼ãè¦æ±ãããè¦ç´ ã«ã¤ãã¦ã®ã¿è¡ããã¾ãã ã¾ããã¯ã©ã¤ã¢ã³ãå´ã§ã®æ¤è¨¼ãè¡ãããå ´åã¯ãå¿ è¦ãª javascript ã³ã¼ããçæããã¾ãã ãµã¼ãå´ã§ã®æ¤è¨¼ã¯ï¼ããã©ã«ãã§ã¯ï¼å¸¸ã«è¡ããã¾ãã </para> <para> ãã©ã¼ã ã¸ã®ãã¼ã¿ã®ã¤ã³ãã¼ãããéä¿¡ããããã©ã¼ã ã®å¦çã«éãã¦ããã£ã«ã¿ãå©ç¨ãããã¨ãã§ãã¾ãã ãã£ã«ã¿ã¯ãæåã«ç»é²ã®å¿ è¦ããªããã¨ãé¤ããæ¤è¨¼ã«ã¼ã«ã¨åæ§ã«åä½ãã¾ãã ãã£ã«ã¿é¢æ°ãæ¸ããã¹ã¯ãªããããã³ã¼ã«ãã¾ãã (trim, addslashes, htmlentities, ãªã©ã®) ãã¹ã¦ã® PHP 颿°ã使ç¨ã§ãã¾ãããè¦ç´ å¤ã¸å帰çã«é©ç¨ããã¾ãã </para> &package.html.html-quickform.intro-validation; &package.html.html-quickform.html-quickform.addrule; &package.html.html-quickform.html-quickform.addgrouprule; &package.html.html-quickform.html-quickform.addformrule; &package.html.html-quickform.html-quickform.iselementrequired; &package.html.html-quickform.html-quickform.validate; &package.html.html-quickform.html-quickform.getelementerror; &package.html.html-quickform.html-quickform.setelementerror; &package.html.html-quickform.html-quickform.registerrule; &package.html.html-quickform.html-quickform.getregisteredrules; &package.html.html-quickform.html-quickform.isruleregistered; &package.html.html-quickform.html-quickform.applyfilter; </sect3> </sect2> <sect2 id="package.html.html-quickform.output"> <title>ãã©ã¼ã ã®åºå</title> <para> HTML_QuickForm ã¯ããããããªç¨®é¡ã®ã¬ã³ãã©ã®ä½¿ç¨ãå¯è½ã§ãã®ã§ã ãã©ã¼ã ã®åºåãæ§ã ã«ã«ã¹ã¿ãã¤ãºãããã¨ãã§ãã¾ãã ããã©ã«ãã®ã¬ã³ãã©ã使ãã°ãåè¦ç´ ã®å±æ§å¤ãã¨ã©ã¼ã¡ãã»ã¼ã¸ã»ãããã»å¿ é å ¥åæ¬ã®è¡¨ç¤ºã¨ãã£ãç¹ã ã«ã¹ã¿ãã¤ãºã§ãã¾ãããç¬èªã®ã¬ã³ãã©ãæ¸ããã¨ãå¯è½ã§ãã </para> <sect3 id="package.html.html-quickform.output.form-customization"> <title>ãã©ã¼ã ã®ã«ã¹ã¿ãã¤ãºã¨åºåãã«ãã¼</title> &package.html.html-quickform.html-quickform.freeze; &package.html.html-quickform.html-quickform.iselementfrozen; &package.html.html-quickform.html-quickform.isfrozen; &package.html.html-quickform.html-quickform.setrequirednote; &package.html.html-quickform.html-quickform.setjswarnings; &package.html.html-quickform.html-quickform.getrequirednote; &package.html.html-quickform.html-quickform.getvalidationscript; &package.html.html-quickform.html-quickform.accept; &package.html.html-quickform.html-quickform.defaultrenderer; &package.html.html-quickform.html-quickform.toarray; &package.html.html-quickform.html-quickform.tohtml; </sect3> <sect3 id="package.html.html-quickform.output.basic-renderers"> <title>åºæ¬çãªã¬ã³ãã©</title> <para> ãããã®ã¬ã³ãã©ã¯ããã¼ã¸ã§ã³3.0以åã® <classname>HTML_QuickForm</classname> ã³ã¼ãã åºç¤ã¨ãã¦ãããåä½ã«ä»ã®ã¯ã©ã¹ãå¿ è¦ã¨ãã¾ããã </para> &package.html.html-quickform.intro-renderers; &package.html.html-quickform.html-quickform-renderer-default; &package.html.html-quickform.html-quickform-renderer-default.clearalltemplates; &package.html.html-quickform.html-quickform-renderer-default.setelementtemplate; &package.html.html-quickform.html-quickform-renderer-default.setformtemplate; &package.html.html-quickform.html-quickform-renderer-default.setgroupelementtemplate; &package.html.html-quickform.html-quickform-renderer-default.setgrouptemplate; &package.html.html-quickform.html-quickform-renderer-default.setheadertemplate; &package.html.html-quickform.html-quickform-renderer-default.setrequirednotetemplate; &package.html.html-quickform.html-quickform-renderer-default.tohtml; &package.html.html-quickform.html-quickform-renderer-array; &package.html.html-quickform.html-quickform-renderer-array.html-quickform-renderer-array; &package.html.html-quickform.html-quickform-renderer-array.setelementstyle; &package.html.html-quickform.html-quickform-renderer-array.toarray; </sect3> <sect3 id="package.html.html-quickform.output.template-renderers"> <title>ãã³ãã¬ã¼ããã¼ã¹ã®ã¬ã³ãã©</title> <para> ãããã®ã¬ã³ãã©ã¯ããã©ã¼ã ã® HTML åºåã®çæã«ãã³ãã¬ã¼ãã¨ã³ã¸ã³ã使ç¨ãã¾ãã </para> &package.html.html-quickform.html-quickform-renderer-arraysmarty; &package.html.html-quickform.html-quickform-renderer-arraysmarty.html-quickform-renderer-arraysmarty; &package.html.html-quickform.html-quickform-renderer-arraysmarty.seterrortemplate; &package.html.html-quickform.html-quickform-renderer-arraysmarty.setrequiredtemplate; &package.html.html-quickform.html-quickform-renderer-itdynamic; &package.html.html-quickform.html-quickform-renderer-itdynamic.html-quickform-renderer-itdynamic; &package.html.html-quickform.html-quickform-renderer-itdynamic.setelementblock; &package.html.html-quickform.html-quickform-renderer-itdynamic.setheaderblock; &package.html.html-quickform.html-quickform-renderer-itstatic; &package.html.html-quickform.html-quickform-renderer-itstatic.html-quickform-renderer-itstatic; &package.html.html-quickform.html-quickform-renderer-itstatic.seterrortemplate; &package.html.html-quickform.html-quickform-renderer-itstatic.setrequiredtemplate; &package.html.html-quickform.html-quickform-renderer-quickhtml; &package.html.html-quickform.html-quickform-renderer-quickhtml.html-quickform-renderer-quickhtml; &package.html.html-quickform.html-quickform-renderer-quickhtml.tohtml; &package.html.html-quickform.html-quickform-renderer-quickhtml.elementtohtml; </sect3> <sect3 id="package.html.html-quickform.output.renderer-doc"> <title>ã¬ã³ãã©ã®ã¤ã³ãã©ã¹ãã©ã¯ãã£</title> <para> æ¢åã®ã¬ã³ãã©ãæ¡å¼µããããæ°ããã¬ã³ãã©ãæ¸ãå ´åã«ã¯ã以ä¸ãåèã¨ãªãã§ãããã </para> &package.html.html-quickform.html-quickform-renderer; &package.html.html-quickform.html-quickform-renderer.startform; &package.html.html-quickform.html-quickform-renderer.finishform; &package.html.html-quickform.html-quickform-renderer.startgroup; &package.html.html-quickform.html-quickform-renderer.finishgroup; &package.html.html-quickform.html-quickform-renderer.renderelement; &package.html.html-quickform.html-quickform-renderer.renderheader; &package.html.html-quickform.html-quickform-renderer.renderhidden; &package.html.html-quickform.html-quickform-renderer.renderhtml; </sect3> </sect2> </sect1> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/ja/package/html/html-quickform/tutorial.xml?r=1.1&p=1 Index: peardoc/ja/package/html/html-quickform/tutorial.xml +++ peardoc/ja/package/html/html-quickform/tutorial.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.2 Maintainer: haruki Status: partial --> <refentry id="package.html.html-quickform.tutorial"> <refnamediv> <refname>ã¯ã¤ãã¯ã¹ã¿ã¼ãã¬ã¤ã</refname> <refpurpose>HTML_QuickForm ãã¥ã¼ããªã¢ã«</refpurpose> </refnamediv> <refsect1 id="package.html.html-quickform.tutorial.purpose"> <title>ã¤ã³ãããã¯ã·ã§ã³</title> <para> ãã®ãã¥ã¼ããªã¢ã«ã¯ãQuickForm ãåãã¦ä½¿ãã¦ã¼ã¶ã«å¯¾ãã¦ã æ©è½ã¨ä½¿ç¨æ³ã®æ¦è¦ãç´¹ä»ãããã®ã§ãã ããã§ã¯ãå©ç¨ã§ããæ©è½ã®å ã®ã»ãã®ä¸é¨ã ãã«ã¤ãã¦è§£èª¬ãã¾ããã ããåºãæ·±ãç¥ãããã«æ¬ããã¥ã¢ã«ã®ã©ããè¦ãã°è¯ããã«ã¤ãã¦ã示ãã¦ããã¾ãã </para> <para> Keith Edmunds ã«ãã£ã¦æ¸ããããQuickForm ã®ä½¿ç¨æ³ã«ã¤ãã¦ã® <ulink url="http://www.thelinuxconsultancy.co.uk/quickform.html">ããã¶ãé·ãã®ãã¥ã¼ããªã¢ã«</ulink> ãåèã¨ãªãã§ãããã </para> </refsect1> <refsect1 id="package.html.html-quickform.tutorial.firstform"> <title>ã¯ããã¦ã®ãã©ã¼ã </title> <example> <title>åºæ¬çãªä½¿ç¨æ¹æ³</title> <programlisting role="php"> <![CDATA[ // ã¡ã¤ã³ã¯ã©ã¹ã®èªã¿è¾¼ã¿ require_once 'HTML/QuickForm.php'; // HTML_QuickForm ãªãã¸ã§ã¯ããçæ $form = new HTML_QuickForm('firstForm'); // ãã©ã¼ã è¦ç´ ã®ããã©ã«ãå¤ãè¨å® $form->setDefaults(array( 'name' => 'Joe User' )); // ãã©ã¼ã ã«è¦ç´ ãããã¤ã追å $form->addElement('header', null, 'QuickForm tutorial example'); $form->addElement('text', 'name', 'Enter your name:', array('size' => 50, 'maxlength' => 255)); $form->addElement('submit', null, 'Send'); // ãã£ã«ã¿ã¨æ¤è¨¼ã«ã¼ã«ã追å $form->applyFilter('name', 'trim'); $form->addRule('name', 'Please enter your name', 'required', null, 'client'); // ãã©ã¼ã ã®å¦¥å½æ§æ¤è¨¼ if ($form->validate()) { echo '<h1>Hello, ' . htmlspecialchars($form->exportValue('name')) . '!</h1>'; exit; } // ãã©ã¼ã ã®åºå $form->display(); ]]> </programlisting> </example> <para> ã§ã¯ãé ã追ã£ã¦ä¸è¨ã®ä¾ãæ¤è¨ãã¦è¡ãã¾ãããã </para> <refsect2 id="package.html.html-quickform.tutorial.firstform.building"> <title>ãã©ã¼ã ã®æ§ç¯</title> <para> <programlisting role="php"> <![CDATA[ $form = new HTML_QuickForm('firstForm'); ]]> </programlisting> ã®è¡ã§ãHTML_QuickForm ãªãã¸ã§ã¯ããçæããã¦ãã¾ãã å¾ã§ããã®HTML_QuickForm ãªãã¸ã§ã¯ãã«ãè¦ç´ ã«å¯¾å¿ãããªãã¸ã§ã¯ããä»ã®å¿ è¦ãªæ å ±ãå ãã¦ãããã¨ã¨ãªãã¾ãã ããã§ã<link linkend="package.html.html-quickform.html-quickform.html-quickform">ã³ã³ã¹ãã©ã¯ã¿</link>ã«ã¯ã ãã©ã¼ã ã®åç§°ã®ã¿ã渡ããä»ã®ãã©ã¡ã¼ã¿ã¯ããã©ã«ãå¤ã使ããã¦ãã¾ãã ãã©ã¼ã ã® method 屿§ã«ã¯ <literal>POST</literal> ããaction 屿§ã«ã¯ç¾å¨ã®ãã¡ã¤ã«åã¨ãªãã¾ãã When using QuickForm, it is easier to keep all the form related logic in one file. </para> <para> You might guess that <programlisting role="php"> <![CDATA[ $form->setDefaults(array( 'name' => 'Joe User' )); ]]> </programlisting> sets the default value for <literal>name</literal> element to <literal>'Joe User'</literal>. QuickForm has the concept of default values (set via <link linkend="package.html.html-quickform.html-quickform.setdefaults"><function>setDefaults</function></link> method) and constant ones (set via <link linkend="package.html.html-quickform.html-quickform.setconstants"><function>setConstants</function></link>). The difference between them is that user's input overrides default values but not constant ones. </para> <para> Our form will consist of three elements: <programlisting role="php"> <![CDATA[ $form->addElement('header', null, 'QuickForm tutorial example'); $form->addElement('text', 'name', 'Enter your name:', array('size' => 50, 'maxlength' => 255)); $form->addElement('submit', null, 'Send'); ]]> </programlisting> The first one is not the 'real' element, it is just a heading to improve presentation. The second one actually is a text input box and the third is a submit button. Note that parameters for <link linkend="package.html.html-quickform.html-quickform.addelement"><function>addElement</function></link> method have different meanings for different elements. That is so because they are actually passed to these elements' constructors. </para> </refsect2> <refsect2 id="package.html.html-quickform.tutorial.firstform.checking"> <title>Checking input</title> <para> The line <programlisting role="php"> <![CDATA[ $form->applyFilter('name', 'trim'); ]]> </programlisting> defines a <link linkend="package.html.html-quickform.intro-validation.filters">filter</link> for the 'name' element value - the function that will be applied to it after form submit. In this case it is a builtin <ulink url="&url.php.lookup;trim"><function>trim</function></ulink> function, but can be any valid <ulink url="&url.php.callback;"><type>callback</type></ulink>. Thus we will strip all whitespace from the name, as we do not actually need it and as we want to be sure that a name was entered, not just some spaces. </para> <para> Next we define a <link linkend="package.html.html-quickform.intro-validation.rules">rule</link> for the name field: <programlisting role="php"> <![CDATA[ $form->addRule('name', 'Please enter your name', 'required', null, 'client'); ]]> </programlisting> This means that QuickForm will display an error message if the name was not entered. The <literal>'client'</literal> modifier is here to switch on client-side JavaScript validation in addition to server-side one. Note also that QuickForm will automatically mark required fields in the form. </para> </refsect2> <refsect2 id="package.html.html-quickform.tutorial.firstform.processing"> <title>Validating and processing</title> <para> We now have the form built and rules defined and need to decide whether to process it or display: <programlisting role="php"> <![CDATA[ if ($form->validate()) { // Do some stuff } ]]> </programlisting> The <link linkend="package.html.html-quickform.html-quickform.validate"><function>validate</function></link> method will consider the form valid (i.e. return &true;) if some data was actually submitted and all the rules defined for the form were satisfied. In our case this means that 'name' element was not empty. </para> <para> If the form is validated we need to process the values <programlisting role="php"> <![CDATA[ echo '<h1>Hello, ' . htmlspecialchars($form->exportValue('name')) . '!</h1>'; exit; ]]> </programlisting> This is an example, in your scripts you'll usually want to store the values somewhere and to redirect to some other page to prevent a duplicate submit. The <link linkend="package.html.html-quickform.html-quickform.process"><function>process</function></link> and <link linkend="package.html.html-quickform.html-quickform.exportvalues"><function>exportvalues</function></link> methods may be of interest here. </para> <para> The last line is pretty easy: <programlisting role="php"> <![CDATA[ $form->display(); ]]> </programlisting> If the form is not valid, which means that it either was not yet submitted or that there were errors, it will be displayed. Error messages (if any) will be displayed near the corresponding elements. </para> </refsect2> </refsect1> <refsect1 id="package.html.html-quickform.tutorial.advanced"> <title>Advanced features</title> <para> You now should have an understanding of basic QuickForm functionality, but there are many more features in the package, each of them deserving a separate tutorial. This section will give a short overview of them and point you to the complete documentation. </para> <para> <link linkend="package.html.html-quickform.groups">Groups</link> allow to combine several individual elements into one entity and to use it as one element. This is also used to create pseudo-elements like date and hierselect. </para> <para> QuickForm offers a lot of possibilities to customize form layout and appearance. Form output is done via <link linkend="package.html.html-quickform.intro-renderers">renderers</link> - special classes containing necessary logic. There are renderers that <link linkend="package.html.html-quickform.html-quickform-renderer-default">directly output HTML</link> and those that <link linkend="package.html.html-quickform.output.template-renderers">use template engines</link> for this. </para> <para> And finally, you can extend QuickForm by adding your own element types, rules and <link linkend="package.html.html-quickform.output.renderer-doc">renderers</link>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-executeMultiple-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->