Wednesday 8 May 2013

Javascript to validate a text filed to add only number

Javascript to validate a text filed to add only number

<asp:TextBox ID="txtboxForDays" runat="server" OnKeyPress="return AllowNumericOnly(this);"></asp:TextBox> 

<script type="text/javascript">
                function AllowNumericOnly(e) {
                    var keycode;
                    if (window.event)
                        keycode = window.event.keyCode;
                    else if (event)
                        keycode = event.keyCode;
                    else if (e)
                        keycode = e.which;
                    else return true;
                    if ((keycode > 47 && keycode <= 57)) { return true; }
                    else { return false; } return true;
                } 
    </script>

Hiding Sharepoint 2010 Ribbon in New Form.aspx with Jquery


Hiding Sharepoint 2010 Ribbon in New Form.aspx with Jquery




//using below script you can hide entire ribbon
//$(“div.’s4-ribboncont:contains(‘Spelling’)”).parent(‘div’)[0].style.display = “none”;
//using below script you can hide ribbon but the dark blue background will remain visible
//$(“div.ms-cui-tabContainer:contains(‘Spelling’)”).parent(‘div’).hide();
//using below script you can hide save Button in Ribbon
//$(“span.ms-cui-ctl-largelabel:contains(‘Save’)”).parent(“a”).hide();
//using below script you can hide past Button in Ribbon
//$(“span.ms-cui-ctl-largelabel:contains(‘Paste’)”).parent(“a”).hide();
//using below script you can hide Cancel Button in Ribbon
//$(“span.ms-cui-ctl-largelabel:contains(‘Cancel’)”).parent(“a”).hide();
//using below script you can hide Attachment Button in Ribbon
//$(“span.ms-cui-ctl-largelabel:contains(‘Attach’)”).parent(“a”).hide();
//using below script you can hide Cut Button in Ribbon
//$(“span.ms-cui-ctl-mediumlabel:contains(‘Cut’)”).parent(“a”).hide();
//using below script you can hide Copy Button in Ribbon
//$(“span.ms-cui-ctl-mediumlabel:contains(‘Copy’)”).parent(“a”).hide();
//using below script you can hide Spelling Button in Ribbon
//$(“span.ms-cui-ctl-largelabel:contains(‘Spelling’)”).parent(“a”).hide();
//using below script you can hide
//$(“span.ms-cui-ctl-a1Internal”).parent(“a”).hide();
//using below script you can hide Menu Label Action in Ribbon
//$(“span.ms-cui-groupTitle:contains(‘Actions’)”).hide();
//using below script you can hide Menu Label Commit in Ribbon
//$(“span.ms-cui-groupTitle:contains(‘Commit’)”).hide();
//using below script you can hide Menu Label Clipboard in Ribbon
//$(“span.ms-cui-groupTitle:contains(‘Clipboard’)”).hide();
//using below script you can hide Menu Label Spelling in Ribbon
//$(“span.ms-cui-groupTitle:contains(‘Spelling’)”).hide();
//using below script you can hide Menu Separator in Ribbon
//$(“span.ms-cui-groupSeparator”).hide();

Friday 1 February 2013

Hide Upload Document item in Sharepoint Ribbon

It hid the Upload button and am hiding the Add New with the Main web part zone:

Using CSS


<style type="text/css"> 
#Ribbon\.Documents\.New\.AddDocument-Large
{     
 display:none !important; 
} 
</style>
<style type="text/css"> 
td.ms-addnew
{     
 display:none !important; 
} 
</style>

Wednesday 23 January 2013

Javascript to validate a text filed to add only number

<asp:TextBox ID="txtboxForDays" runat="server" OnKeyPress="return AllowNumericOnly(this);"></asp:TextBox>

<script type="text/javascript">
                function AllowNumericOnly(e) {
                    var keycode;
                    if (window.event)
                        keycode = window.event.keyCode;
                    else if (event)
                        keycode = event.keyCode;
                    else if (e)
                        keycode = e.which;
                    else return true;
                    if ((keycode > 47 && keycode <= 57)) { return true; }
                    else { return false; } return true;
                }
    </script>