When you are working with html form, you might need this below javascript code to implement form reset and cancel features.

 <script type="text/javascript">
 function clearform(){
 if(confirm("Are you sure you want to reset the form?")){
 document.res_reg.reset();
 }
 }

function cancelAction() {
 var cancel=confirm("Are you sure you want to cancel?")
 if (cancel==true)
 {
 // Go back (Same result as pressing browser back button)
 history.go(-1);
 }
 else
 {
 <!-- nothing happens-->
 }
 }
 </script>
 <input type="button" value="Reset" onclick="clearform();return false" />
 <input type="button" value="Cancel" onclick="cancelAction();" />
 

This is not new but I would like it to be posted on my site. So here is the jQuery code to trigger the event when user selects the HTML option box.

<script type="text/javascript">
jQuery(document).ready(function($){
 $("#yourOptionID").change(function (){
 var selVal = $("#yourOptionID").val();
 if(selVal != null){
 //Add your code
 }
 else {
 //Add your code
 }
 });
 });
 </script>

As I wrote in my previous post, I am working on the sitefinity project and it is almost done so I have some spare time to care my blog. :)   So I will start posting sitefinity related tips and tricks which I found them during the development.

Well! Here is the first Sitefinity tips and tricks for someone who wants to get current page name.

    //get the current page name e.g. home.aspx
    protected IPage getPage()
    {
        ICmsUrlContext pageKey = (ICmsUrlContext)this.Context.Items[Telerik.Cms.Web.UrlHelper.CmsPageKey];
        Guid currentPageID = pageKey.PageID;
        var cmsManager = new CmsManager();
        IPage page = cmsManager.GetPage(currentPageID);
        return page;
    }

Since last December I’ve assigned to the Sitefinity CMS (.NET) project and client was chasing me like a hell so I did not even have time to look at my blog and reply the comments.  Sorry for those who asked the questions and never got reply from me.  I am really sorry for that and  also thanks to who helped me to reply some questions on my blog.

Anyway, my next project will be WordPress site and if I found something useful tips and tricks, I will definitely post it on my blog.  So do not forgot to check my blog regularly!

Thank you!