This article mainly introduces how the Form Wizard function of Phpcms V9 is used, and it is explained by several cases. First, let's talk about how V9 's Form Wizard can be used to create a form, which is often used as a message board. Or in the recruitment column as a personal information for users to fill out the application form. For forms, the default template is placed in the./phpcms/templates/default/formguide/. There are three files in the folder index.html table of the foreground, show.html Single form display, Show_js. HTML Form plug-in, the form as a functional module, often as a plug-in embedded in the page, rather than a separate model, so the template used is Show_js. HTML Template page. 1. The first step is to create a new form using the Form Wizard 2. each form corresponds to a calling JS code, as shown in the input box below the calling entry <script language= ' javascript ' src= ' {app_path}index.php?m=formguide &c=index&a=show&formid=12&action=js&siteid=1 ' ></script>3. adding the calling code to the other Templates page is ok.
case one use V9 Background Form Wizard to do the message board function of the foreground
Application Scenarios for the Form Wizard:
Before making a form: Assign the Formguide folder under the default folder to the template folder you want to do.
If a foreground page is just for submitting form data, then it is very suitable for the functions of the Form Wizard, such as the following message board case; If a foreground page is not just for submitting a form, it also requires that the content of the submission form be displayed on the current foreground page, which is not appropriate for the Form Wizard. More suitable for installation as a module or plug-in, such as the front page needs to display user message information situation
As follows:
1, enter "module"
2. Select the Form Wizard
3, click "Add Form Wizard" in the "name" fill the "message board", and then "table name" fill in "Liuyanban", and then "allow visitors to submit form" column Select "Yes". OK again.
4, this time there is a "message board" information, and then we found in the following "add field."
5, click "Add Field" in the first row "field type" selection, we generally see the message board the first column is "title" Right, and "title" is a "single line of text", then we also choose "Single line of text." Then the second column "field type", here is the table name placed in the database, used to hold the "title" data, then I will fill in a "title" Pinyin abbreviation: Biaoti. Next is the field alias, and we'll just write "title". The following is the "field hint", here can not fill, but in order to let users better experience, we still fill in a hint is better, fill in the "Please fill in the title." The following is the "related parameters" fill in, "title" text box length is generally filled with 50 bar, the default value can be written to write. Then the others will be used in the tube, submit it directly. After the submission, we will find that the field we have just added has come out, we can click on the "Preview" button above to see the effect, how? Is there an input box that fills in the title?
6, Next we continue to add fields, according to our needs, we add: message people, gender, contact phone, message content and other fields. Note that like "message person" and "contact phone" When you select a field type, you can select single line of text as "title", "Gender" selects "Options" when selecting a field type, and "message content" to select "Multiline text" or "editor".
7, after all the fields have been added, we go back to "module" under "Form Wizard" here. We can see that there is a "call" script behind "message board", we put this script in our production of the Message Board template page can be used, as follows:
case two , Phpcms v9 The Form Wizard to implement the method of question and answer advisory function PHPCMS v9 Content management system itself is not a question and answer module, only the Form Wizard, but the Form Wizard has great limitations, through the Form Wizard, we can only view user-submitted information, The information submitted by the user cannot be replied to. For example, some agencies ' websites need a function of receiving users ' questions and replying to questions, but only using the Form Wizard can not satisfy this requirement, but the following method will make some changes to the Form Wizard module to realize the question and answer function. In Phpcms v9 background new Form Wizard "online question and answer", the table named "Online_ask", the table name is set, such as.
To add a field to the "online quiz", for example, what field to add is determined according to the requirements.
is the preview effect of the form.
This will allow the user to submit the question through the form, but in the background, the site editor can only view the problem through the Form Wizard module, cannot answer it, and display questions and answers on the site's foreground, for example.
In order to achieve web site editing while viewing the problem, but also to answer questions, you need to make the following changes to the form module: Open File Phpcms/modules/formguide/templates/formguide_info_view.tpl.PHP, add the following below line 28th:<tr><td> Back answer:</td><td>< TextArea id= "Answer" cols= "ten" rows= "><?php"Echo $answer;?></textarea></td></tr><tr> <td> </td><td><input id= " Tijiaohuida "type=" button "value=" Submit Answer "/></td></tr>The above variablesyou know, $answer where you're going, keep looking down.below line 30th, add the following:<script type= "Text/javascript" >$ (document). Ready (function(){varCanshustr=window.location.Search;var POS=canshustr.indexof ("&did");varPosend=canshustr.indexof ("&",POS+4);varDid_c=canshustr.substring (POS+5,posend);varAnswer_c= "";$("#tijiaohuida"). Click (function() {answer_c= $ ("#answer").Val (); $. Post (' Index.php?m=formguide&c=formguide_info&a=public_answer ',{ did: Did_c,Answer:Answer_c},function(JSON) {if(json==1) {alert ("Successful Answer");}}); }); });</script>then open the file Phpcms/modules/formguide/formguide_info.PHP, add the following code in line 56:$answer=$info[' Answer ']; At the end, add a method with the following code. Public functionPublic_answer () {$did=$_post[' Did '];$answer=$_post[' Answer '];$re=$this->db->query ("Update kc_form_online_ask set answer= '".$answer. "', mark= ' has answered ' where dataid= '.$did);Echo $re;} The above variablesyou know, $answer where you're going, keep looking down.below line 30th, add the following:<script type= "Text/javascript" >$ (document). Ready (function(){varCanshustr=window.location.Search;var POS=canshustr.indexof ("&did");varPosend=canshustr.indexof ("&",POS+4);varDid_c=canshustr.substring (POS+5,posend);varAnswer_c= "";$("#tijiaohuida"). Click (function() {answer_c= $ ("#answer").Val (); $. Post (' Index.php?m=formguide&c=formguide_info&a=public_answer ',{ did: Did_c,Answer:Answer_c},function(JSON) {if(json==1) {alert ("Successful Answer");}}); }); });</script>then open the file Phpcms/modules/formguide/formguide_info.PHP, add the following code in line 56:$answer=$info[' Answer ']; At the end, add a method with the following code. Public functionPublic_answer () {$did=$_post[' Did '];$answer=$_post[' Answer '];$re=$this->db->query ("Update kc_form_online_ask set answer= '".$answer. "', mark= ' has answered ' where dataid= '.$did);Echo $re;} Then we found the data table stored in the database, and added two fields mark and Answer,mark are used to mark whether the problem has been answered, answer is used to store the answer. These are all the changes. This is how the interface looks when we look at user-submitted issues.
Fill in the answer and click Submit, you can store the answer data in the form of the data sheet, in the front of the site, we can put the user's questions and the site editor's answer to show out, such as:
This allows us to use the Form Wizard module to implement a simple online consulting function. Website wwwYtsfc.com's online consulting function is achieved through the above method, we can see the specific effect.
How to Use the Form Wizard feature of Phpcms V9