Posts tonen met het label Event. Alle posts tonen
Posts tonen met het label Event. Alle posts tonen

zondag 7 september 2014

Trigger click event in your aspx page


How to trigger easely an event on your Sharepoint ASPX page by using JQuery. 
Well, it doesn't need very mutch to trigger automatically by example the save event
by using your scripting language.For example if somebody fills all required fields in 
and you detected that is was filled in correctly... you can trigger the save event without asking
the user to click on the save button. And this saves time for your customer. 

A simple line of code that you can put in your javascript 
Don't forget that you have to import your JQuery library ! 
  

      $("input[value='Save']").trigger("click");
 

donderdag 17 januari 2013

Replace Point keystroke with a Comma


Sometimes you need to prevent your user to use some key characters in your Input Fields.
Like my customer wanted also to use the Comma [,] as the Point [.] as decimal seperator. 
If you use for example Dutch regional settings the decimal seperator is the [,] and the Point is used
as thousant seperator. So my customer wanted to use as Point as Comma as seperator. 
What to do about it? 
Simple answer. Catch the keystroke of the Point and replace it by a Comma. 
My solution below is not perfect if they put a Point between the numbers. 
If someone knows what I have to add in place of the fill up of the ","
please don't hesitate to let me know.
 

$(document).ready(function() {
 if ($(":input[title='MyField']").val() != "")
  $("nobr:contains('MyField')").closest('tr').hide();
 ReplacePointbyComma();
});

function ReplacePointbyComma(){
    $(":input[title='MyNumericField']").keydown(function(e) {
  var keycode = (e.keyCode ? e.keyCode : e.which);
  /// 110 Point on numeric keyblock
  /// 190 Shift Point in alfanumeric keyblock
  if (keycode == 110 || keycode == 190 )
  {
   e.preventDefault();
   $(":input[title='MyNumericField']").val($(":input[title='MyNumericField']").val() + ",");
  }
 });
}
 

donderdag 5 april 2012

Block Excape and Ctrl+z keypress to prevent the undo action by keyboard


One of the disadvantages of using Jscript of JQuery is when a user uses 
the Escape or CTRL+z on his keyboard that 
your actions, like filling in input fields, in your scripting are being undone.

So best option in this case is to prevent that thoose events are being executed.
This you can do by capturing the keypresses of the Escape key and the CTRL+z key combination.
The script below will execute on the document Keydown event. 

 function DisableEscAndCtrlZ(){
  document.onkeydown = function(evt) {
   evt = evt || window.event;
   // ctrl+z
   if (evt.ctrlKey && evt.keyCode == 90) {
    return false;  
   }
   // esc
   if (evt.keyCode == 27) {
    return false;  
   }
  };
 }

 $(document).ready( function() {
  DisableEscAndCtrlZ();
 };