4 days Learn noahweb form-the next day

Source: Internet
Author: User
Tags empty expression query variable
Web

Hello, everyone! Today is the next day, yesterday I talked about the introduction of "form" in Noahweb, and today we are going to look at other things.

In a variety of controls in a form, you can use the Values tab to provide "selected values" in a noahweb form if you are involved in a control with "selected values", such as the Select,radio,choice type, and so on. Using the values tag also makes it easy to get the selected value from the database, and values are easy to use. This is part of what we're talking about today.

Do you remember the controls that were mentioned yesterday? Select, for example, is the Drop-down list, the most commonly used form. An optional value in a drop-down list can be added to the <option value> tag, just like the following code:

<option value= "A" >A</option>

This is a fixed value for the "Chosen" content, and most of the time I can use the content in the database as the chosen value, in which case you can use what we want to speak today-the contents of the database as the selected value. We'd better look at the following code:

<inputline text= "department:" desc= "" >

<input id= "mydept" type= "select" >

<Label></Label>

<LabelClass>label</LabelClass>

<NullErrorString> Please select the employee Department!</nullerrorstring>

<Values valuessqllink= "Dept_s_all" valuessqlvalue= "[_loop.*.id]" valuessqllabel= "[_loop.*.name]" Byselectarraystring= "[Mydept]" >

<option value= "" > Please select </option>

</Values>

<class>myinputstyle</class>

</Input>

</InputLine>

In the above example, using the Dept_s_all database operation set to query the Database Dept table, Dept table structure and contents are as follows:

The Dept_s_all database operation set is in the Noahweb designer as follows:

For database operations in the Noahweb designer you can refer to other articles, and we will not say them today when we talk about the form.

Let's go back and look at the code. Or the above code:

<inputline text= "department:" desc= "" >

<input id= "mydept" type= "select" >

<Label></Label>

<LabelClass>label</LabelClass>

<NullErrorString> Please select the employee Department!</nullerrorstring>

<Values valuessqllink= "Dept_s_all" valuessqlvalue= "[_loop.*.id]" valuessqllabel= "[_loop.*.name]" Byselectarraystring= "[Mydept]" >

<option value= "" > Please select </option>

</Values>

<class>myinputstyle</class>

</Input>

</InputLine>

Do you see the type of input in the code above? is a select is the Drop-down list, and then look at the parts of the Values tab, the details of the section listen to me slowly!

1, first look at the values tag, which can be used to specify the source of optional values in the control. And today. Using a database query to provide an optional value to a control requires matching several parameters of the values label.

2, parameter Valuesqllink to specify a set of database operations, to indicate through that database operation to get the content of the selected value. Now I'm specifying the "Dept_s_all" set of operations. This generates the selected value content based on the return result of the Dept_s_all action set.

3, valuesqlvalue parameter to represent the value of the control selectable value of the corresponding variable expression, simple point that we want to use the contents of the ID field in the database as the value of the selected value content can be written as "[_loop.*.id]." This shows that the variables in Noahweb are identified using "[]", and [_loop.*.id] is a method of variable representation, to learn more about Noahweb variable representations You can view the official Noahweb documentation.

The 4,valuessqllabel parameter represents the name expression for the value of the selectable value of the control. To put it simply, we want to use the Name field content in the database to make the selected value display text, written as "[_loop.*.name]".

To be blunt, Valuessqllabel is the value that is seen in the Drop-down list, and Valuesqlvalue is the value that is corresponding to the value that you select in the Drop-down list.

When you put this select in a Noahweb form, we look at the form. The following figure:


The red circle part of the figure is the actual operation of the above code, is not very easy? The selected value of the select is then changed according to the dept, and if you want a new department to appear in the system, just add the new department content to the Dept table.

And, not only the Select type control can do this, what, radio,checkbox,choice, can be used. The only thing you need to do is change the type in input from select to radio or checkbox or choice. Other places are not to be changed.

The replacement effect can be seen in the following figure:

The image above is the display of the Type= "Radio".

The image above is the display of the type= "checkbox".

The image above is the display of the type= "choice".

The person who looks closely may have found that after changing type types <option value= "" > Please select </option> no output. If you take a closer look at the types that don't work, you can't choose "empty" and <option value= "" > Please select the value in </option> is empty, so the Noahweb engine filters out the value "null" when it is generated. are selected.

All right, let's get here today! Remember, as long as you can provide a number of selected values of the control, you must use the values tag!



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.