AdvMessageDialog breaks IW Validation

Hello!
I use standard IW validation mechanism for my components inherited from IW controls. Here is the fragment of code

function TFEWCustomEdit.RenderHTML(
  AContext: TIWBaseHTMLComponentContext): TIWHTMLTag;
var F: TField;
    JSName: String;
    FName: String;
begin
  Result := inherited RenderHTML(AContext);
  if Button <> nil then begin
    Button.Enabled := Editable;
  end;
  if Editable then begin
    JSName := HTMLName + 'IWCL';
    FName := QuotedStr(FriendlyName);
    with (AContext as TIWComponent40Context) do begin
      if NotNull then begin
        AddValidation(Format('!iasCheckRequired(%s)', [JSName]), Format(ss.Load('FEWCONTROLSTUBS', 3), [FName]));
      end;
      case Validation of
        vtByFieldType: begin
          if (DataField <> '') and (DataSource <> nil) and (DataSource.DataSet <> nil) then begin
            F := DataSource.DataSet.FindField(DataField);
            if F <> nil then begin
              case GetIASFieldType(F.DataType) of
                iftInteger: begin
                  AddValidation(Format('!iasValidate(%d, %s)', [0, JSName]), Format(ss.Load('FEWCONTROLSTUBS', 0), [FName]));
                end;
                iftFloat: begin
                  AddValidation(Format('!iasValidate(%d, %s)', [1, JSName]), Format(ss.Load('FEWCONTROLSTUBS', 1), [FName]));
                end;
                iftDateTime: begin
                  AddValidation(Format('!iasValidate(%d, %s)', [2, JSName]), Format(ss.Load('FEWCONTROLSTUBS', 2), [FName]));
                end;
              end;
            end;
          end;
        end;
        vtNumbersOnly: begin
          AddValidation(Format('!iasValidate(%d, %s)', [3, JSName]), Format(ss.Load('FEWCONTROLSTUBS', 4), [FName]));
        end;
        vtInteger: begin
          AddValidation(Format('!iasValidate(%d, %s)', [0, JSName]), Format(ss.Load('FEWCONTROLSTUBS', 0), [FName]));
        end;
        vtFloat: begin
          AddValidation(Format('!iasValidate(%d, %s)', [1, JSName]), Format(ss.Load('FEWCONTROLSTUBS', 1), [FName]));
        end;
        vtDateTime: begin
          AddValidation(Format('!iasValidate(%d, %s)', [2, JSName]), Format(ss.Load('FEWCONTROLSTUBS', 2), [FName]));
        end;
      end;
    end;
  end;
end;

It works fine except when the components are placed on the ContentRegion of the AdvMessageDialog. For some reason IW function Validate() does not fire. Is there an easy way to inject JS code before dialog's OK button onclick event handler?

Can you please let me know which browser you are using and if there are any Javascript errors on the page that is not working as expected? That would allow me to further investigate this issue.


Unfortunately there's currently no possibility of executing custom Javascript when the OK button is clicked.
However this is a good suggestion and we'll consider adding this functionality in a future release of the IWAdvMessageDialog.

I use Firefox 4.0.1. There are no any JS errors in console, the function just doesn't fire.

I've tried to call it manually. I placed IWJQueryWidget on the form and added the following code:
  jQuery.OnReady.Add('$(' + QuotedStr('input[type="submit"]') + ').click(function() {Validate();});');

In this case Validate() fires, but doesn't work properly. If there are any violations (for example the required field is empty), alert is displayed for a short time, but the execution doesn't stop, message dialog is closed and I get session timeout error.