Enter the pimshell (5)-form (Form) Application

Source: Internet
Author: User

We recommend that you use htm, XML, and JS files to implement a web page in pimshell .. The HTM file defines the DOM elements in the interface. The. xml file is the behavior required for Dom element appending (behavior), and The. js file implements JavaScript code. However, in actual applications, you need to put these files into the directory of a plug-in (which can be a self-made Plug-in) for normal operation. To facilitate the compilation and operation of web pages, pimshell provides a special form plug-in. A form can represent a web page and consists of three parts: htm, XML, and JavaScript. The difference is that the form content is stored in the pimshell data file. In this way, form editing and execution are at your fingertips, and form can be imported and exported like other types of data and shared with others.

Is this similar to form in access? Because the form in pimshell is a webpage, the design is more flexible than the form in access. Each form can implement one application, and multiple forms can form a more complex application. You can also set icons for form to facilitate the identification.

On pimshell's official website, a form Gallery (Form Library): http://www.pimshell.com/pimshell/go.asp? Linkid = 7 to facilitate form sharing and communication.

Let's take the user list as an example to see how it is implemented in form.

 

1. Form editing interface

 

2. htm part

  1. <HTML xmlns = "http://www.w3.org/1999/xhtml">
  2. <Head>
  3. <Title> User List </title>
  4. <Link type = "text/CSS" rel = "stylesheet" href = "/CSS/main.css"/>
  5. <XML src = "do. Bin? Itemid = {E143F7B8-3088-4DD8-8DBD-AF6114B73B0A} & type = xml "> </XML>
  6. <SCRIPT type = "text/JavaScript" src = "do. Bin? Itemid = {E143F7B8-3088-4DD8-8DBD-AF6114B73B0A} & type = JS "Language =" JavaScript "> </SCRIPT>
  7. </Head>
  8. <Body>
  9. <Div id = "list1"> </div>
  10. </Body>
  11. </Html>
  • Row 4: defines the page style. InMain.cssThe following style is set for the body in the file:

    1. Body
    2. {
    3. Behavior: URL (# default # pimshell );
    4. }

    This style adds a default behavior called pimshell to the body element. This action is responsible for parsing the subsequent XML file and initiating the onpageload event to execute the code in the JS file.

  • Row 5: defines the XML part and attaches a behavior to the DOM element on the page.

  • Row 6: defines the JS part and contains the required JavaScript code.

  • Row 9: defines a div element named list1 to display list information.

  •  

    3. XML section

      1. <? XML version = "1.0" encoding = "UTF-16"?>
      2. <Page>
      3. <Root enableframe = "false" enablecontextmenu = "false">
      4. <Controls>
      5. <Control ID = "list1">
      6. <Behaviors>
      7. <Listview autofitrows = "false" allowpage = "false">
      8. <Header>
      9. <Cols>
      10. <Col name = "name" text = "name" width = "60">
      11. <Bind>
      12. <Text> [# name #] </text>
      13. </Bind>
      14. </COL>
      15. <Col name = "sex" text = "gender" width = "40">
      16. <Bind>
      17. <Text> [# Sex #] </text>
      18. </Bind>
      19. </COL>
      20. <Col name = "email" text = "email" width = "80">
      21. <Bind>
      22. <A href = "mailto: [* Email *]"> </a>
      23. </Bind>
      24. </COL>
      25. </Cols>
      26. </Header>
      27. </Listview>
      28. </Behaviors>
      29. </Control>
      30. </Controls>
      31. <Events>
      32. <Onpageload handler = "onpageload"/>
      33. </Events>
      34. </Root>
      35. </Page>
    • Row 5: Define element list1 as a part
    • Row 7: Add behavior listview for list1
    • Row 8-26: Define the attribute columns used in the list
    • Row 32: bind the event onpageload

    4. Javascript part

      1. // Event: onpageload
      2. Function onpageload ()
      3. {
      4. // Prepare the record set
      5. VaR oentityset =__ prepareentityset ();
      6. // Bind
      7. $ ("List1"). datasource = oentityset;
      8. $ ("List1"). databind ();
      9. }
      10. // Prepare the record set
      11. VaR g_susers = "Zhang San, male, zhangsan@msn.com; Li Si, male, lisi@msn.com; Wang Xia, female, wangxia@msn.com ";
      12. Function _ prepareentityset ()
      13. {
      14. //
      15. VaR oentityset = SYS. entityset;
      16. //
      17. VaR ouserarray = g_susers.split (";");
      18. For (VAR I = 0; I <ouserarray. length; I ++)
      19. {
      20. // Add a new record
      21. Oentityset. addnew ();
      22. //
      23. VaR oproparray = ouserarray [I]. Split (",");
      24. Oentityset ("name") = oproparray [0];
      25. Oentityset ("sex") = oproparray [1];
      26. Oentityset ("email") = oproparray [2];
      27. }
      28. // Move to the header
      29. Oentityset. movefirst ();
      30. Return oentityset;
      31. }
    • Row 2: RESPONSE event onpageload
    • Row 5: Construct an oentityset for testing.
    • Line 8-9: bind the record set oentityset to the element list1 to display the list.

    5. webpage Running Effect

    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.