4 days Learn noahweb form-third day

Source: Internet
Author: User
Tags add query requires return variable
The Web welcomes everyone to the third day of study, it's nice to see you again! In the course of the previous two days, we were familiar with the form resources in Noahweb. Today we'll learn how to pass values in a form. Let's start with an example. In an application we create a form for adding user input, which can satisfy the input of a new user, and when modifying the user's personal data, A form is also used to show back the information that was previously filled in. We don't need to write a form for this feature again, just use the previous one.

And about back to show the user data, you need to understand the table in the Noahweb conveys value. Or look at the code! This makes sense! ^_^

<form id= "Faqstatusadd" text= "DEMO" a= "Value">
<line text= "" >
<inputline text= "A:" desc= "" >
<input id= "Faqstatusname" type= "text" linkvalue= "[A]">
<Label></Label>
<LabelClass>label</LabelClass>
<NullErrorString>Error!</NullErrorString>
<class>myinputstyle</class>
</Input>
</InputLine>

It's not a complete form. I only post the code that I want to say. The point I need to speak of is also bold.

First step: Add a variable that receives the value in the form label of the sheet that needs to be passed. The example is a= "value" , so to speak! The value in quotation marks is the values passed over, and now that the form is passed, there needs to be a variable to receive it, right? So a variable called A is created to receive the value.

Step two: Now that the value is coming over, you should think of ways to make it appear in the form. This requires the Linkvalue parameter of the input label. This parameter refers to the variable expression corresponding to the echo.

Step three: Write the Linkvalue parameter to the input that needs to be returned. Just like in the example: linkvalue= "[A]. Want to use which input to display this value, add the Linkvalue parameter, and this parameter followed by the natural Is the variable that has just received the value. The method of variable representation in Noahweb I've talked to you about it the next day and I want to see more of the official documents.

The fourth step: to show this form requires an "action", "action" is the soul of Noahweb. Invoking any resource requires "actions" to complete. Since it is now talking about the form, we do not discuss "action". Use an "action" to invoke this form, which requires a viewform tag, which is used to display a form. and send a value to try it. Or look at the code!

<action name= "Manager.addfaqstaus" nextaction= "" >
<out area= "Main" >
  <viewform formlink= "Faqstatusadd" templatelink= "Baset2form" action= "SETFAQSTAUSINFO_EX" >
<var value= "' DEMO '"/>
</ViewForm>
</Out>
</Action>

This is the code that invokes the form in an action, use the Var tab to conveys a value for the table, regardless of what the value is, write a value manually like this in the example, or query the database to return a value, because the work we've done to receive and display in the form just now, So the value can be displayed smoothly. The following figure:

In fact, this transfer value of the truth is very simple, is to use a variable to receive a pass in the value, and then find an input to receive it. It's simple!

If you are passing multiple values, this is often the case when the selected value is a multiple selection, the reason is the same, but the need to use the "," number will need to pass several values separated, When you echo in the input control, you use the byselectarraystring attribute in the Values tab, and the previous linkvalue is for a single input value or a selected value. If it is multiple then use the byselectarraystring! in values to see the following code:

We can use it when defining a form

<form id= "Faqstatusadd" text= "DEMO" a= "value" b= "value" >

The above way to accept two variable values, and then in the input used is as follows:

<input id= "MyGroup" type= "Choice" >
<Label> selectable </Label>
<LabelB> selected </LabelB>
<LabelClass>label</LabelClass>
<size>10</size>
<NullErrorString>Error!</NullErrorString>
<values byselectarraystring= "[B]">
<option value= "1" >a</option>
<option value= "2" >b</option>
<option value= "3" >c</option>
<option value= "4" >d</option>
<option value= "5" >e</option>
</Values>
</Input>

This is a choice type control with five optional values, A,b,c,d,e now we want to show the value of A,b and D, write the following code when the action calls the form:

<action name= "Manager.addfaqstaus" nextaction= "" >
<out area= "Main" >
  <viewform formlink= "Faqstatusadd" templatelink= "Baset2form" action= "SETFAQSTAUSINFO_EX" >
<var value= "' DEMO '"/>
<var value= "' 1,2,4 '"/>
</ViewForm>
</Out>
</Action>

At this time we pass two values to the form to go in, the form is accepted after the difference becomes a and B, the form is displayed after the results of the following figure:

If you need to echo multiple values to use the query database return results, then you can use the loop loop out these values, write in an array, OK! I'm not going to say any more here.

All right! So much has been written, let's watch it slowly! I am a little tired, wash and sleep, and write tomorrow ...



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.