SharePoint: Extended DVWP-Part 2: Analysis list form operation link

Source: Internet
Author: User
Document directory
  • Analyze this link
  • Edit
  • Edit Template
  • Insert
  • Insert Template
  • Delete

As we discussed in the previous blog post that expanded DVWP, we can intercept click events for the built-in OK button in the SharePoint list form. By adding a Javascript call to the HREF parameter of the form operation link, we can extend this mechanism to DVWP. In fact, here we can do more things ......

We can also embed and call a workflow in this way.

Analyze this link

Before going deeper, let's first take a look at the status before the change and know what to change.

First, let's take a quick look at what these out-of-the-box links have done. For each link, the background code is called using JavaScript through the HREF attribute marked by A (Anchor.

Note:: To find these links on your page, click the link in the design view. The corresponding labels in the Code view are highlighted. For editing and inserting templates, you need to switch to these preview views in SPD to see them. For more details, refer to the blog post above this series: Expand DVWP-Part 2: Layout enhancement-Rearrange the bar in the default and edit templates

Edit
<A href = "javascript: {ddwrt: GenFireServerEvent (concat ('_ cancel; dvt_1_form_editkey = {', $ KeyValue, '}')}"> edit </a>

The "edit" link is used to redraw the form by editing the template in place. It executes two functions:

1,Cancel(As a result, the form is repainted .)

2. dvt_shortform_editkey will be assigned with the ID of the current list item. This will display the editing template for this list item.

Edit Template

We have also seen that clicking the edit link will repaint the page with the edit template (or form) corresponding to the current list item, which contains two links: "Save file" and "cancel ".

1. Save
<A href = "javascript: {ddwrt: GenFireServerEvent ('_ commit')}"> Save the file </a>

This call is very simple. It will get the modified content in the form and submit it to the database. There is nothing to say, just save our changes.

2. Cancel
<A href = "javascript: {ddwrt: GenFireServerEvent ('_ cancel')}"> cancel </a>

It is also a very simple call: cancel the modification and do not save it. The confirmation dialog box does not pop up, but simply exits and re-displays the page.

Insert
<A href = "javascript: {ddwrt: GenFireServerEvent ('_ cancel; dvt_form_insertmode = {1}')}"> insert </a>

The insert link is used to redraw the current form by inserting a template in the local area. Similarly, execute the following two functions:

1,Cancel(As a result, the form is repainted .)

2. dvt_shortform_insertmode will be granted with 1 (equivalent to "true"), which will display the insert template to create a new list item.

Insert Template

Like editing, insertion will trigger UI re-painting. A new form is displayed in DVWP and two similar links are displayed at the same time:

1. Save
<A href = "javascript: {ddwrt: GenFireServerEvent ('_ commit')}"> Save the file </a>

This is very similar to the Save link on the editing template mentioned above. Used to save our changes.

2. Cancel
<A href = "javascript: {ddwrt: GenFireServerEvent ('_ cancel')}"> cancel </a>

Uninsert, exit, and display the page again.

Delete
<A href = "javascript: {ddwrt: GenFireServerEvent (concat ('_ cancel ;__ delete = {', $ KeyField, '=', $ KeyValue ,'}; __commit ')} "> Delete </a>

The delete link is used to re-paint the DVWP using the default template, but does not contain the deleted list items. It actually executes three functions:

1,Cancel(Used to prevent the form from executing the regular commit function );

2,Delete(Used to pass the ID of the list item to be deleted to the function to be deleted); and

3,Commit(Used to submit a delete operation for execution ).

Note that there is no verification for whether the object should be deleted; it is only an operation (of course, we can easily recover it through the recycle bin ). In future blog posts, we will modify the execution method.


Next time: We will modify the functions of these links (use the workflow, jQuery, and PreSaveAction () functions to create new editing links and integrate all these functions ).

 

References

SharePoint: Extending the DVWP-Part 6: Examining the Form Action Links

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.