none
CustomPostProcessor RRS feed

  • Question

  •  

     

    I would like to do a custom validaiton based on a value that is published in the modal dialog. 
    I am doing some server side validation on the modal page and giving the user a message, however i wanto add a validation error tag on the field when it s is wrong. 

    My code is as below. thanks 

     //Use the PJ.AddGridSatelliteInitializationNotifier function to get an instance of the satellite

        

    PJ.AddGridSatelliteInitializationNotifier
    
     (
    
     function (satellite) {
    
     if (PJ.TimesheetSatellite != null) {
    
     satellite = PJ._NotifySatelliteInitComplete.arguments[0];
    
    
    
     _satellite = satellite;
    
     _grid = _satellite.GetJsGridControlInstance();
    
     existingValidationFunc = PJ.RemoteTextConv.GetPostprocessor(PJ.ConversionType.String);
    
     PJ.RemoteTextConv.RegisterPostprocessor(PJ.ConversionType.String, CustomPostProcessor);
    
     
    
     function CustomPostProcessor(convType, fieldKey, newValue, bIsLocalized, formatType, textConvConfigs, result) {
    
     if (existingValidationFunc != null) {
    
      result = existingValidationFunc(convType, fieldKey, newValue, bIsLocalized, formatType, textConvConfigs, result);
    
     }
    
     if (result.isValid) {
    
     if (result.dataValue > 480000) {
    
    				var result = showSPDialog(url);
    
    			result.isValid = false;
    
    			 result.errorMsg = "Invalid value entered"; }
    

    function showSPDialog(pageToLoad) {
     var options = {
     url: pageToLoad,
     title: 'Work Reference Validation Page',
     showClose: true,
     width: 700,
     height: 250,
     allowMaximize: false,
     showOK: true
     ,dialogReturnValueCallback: NotifyCallBack
     };
    
     SP.UI.ModalDialog.showModalDialog(options);</span>
    
    }
    
     
     function NotifyCallBack(dialogResult, returnValue) { 
     if (returnValue != null) {
     SP.UI.Notify.addNotification(returnValue);
     }
     }
    <br/>
    
    Please can you help me with getting the value from the window. I am not able to get the value from the dialog page or the NotifyCallBack , please help!

     

    Simi


    Wednesday, July 20, 2011 9:36 AM