GridWeb validation issues


#22

@lswe

Thanks for using Aspose APIs.

Please download and try the following fix for your issue CELLSNET-45928 and let us know your feedback.


For sample code, please refer to the above post. i.e.


#23

The issues you have found earlier (filed as CELLSNET-45928) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi


#24

The issues you have found earlier (filed as CELLSNET-45928) have been fixed in this update. Please also check the following article:* <a href="https://docs.aspose.com/display/cellsnet/Installation


#25

Hi,

I tried the code you suggested. However there is still an issue.

Here is what I have on client :

             function onCellError(cell) {
                ShowModalError("error", '<%=Resources.Resource.InvalidTypedValue%>');
                this.setValid(cell);
                setInnerText(cell.children[0], lastselectvalue);
            }

When I type a wrong value in a validation cell and then I tabulate, I got the error message and the cell value is restored to the last correct value so the behaviour is correct. However when I go back to this cell, the cell value changes and it displays the wrong value. This is not the expected behaviour. It seems that the setInnerText does not change deeply the cell value.

Could you please help me to figure out this issue?

Thanks,


#26

@lswe,

Thanks for the code segment and some details.

See the document with example for your reference:
https://docs.aspose.com/display/cellsnet/Add+Custom+Server-side+Function+Validation

The example works fine as we tested, the older/valid value is restored fine in the relevant cells. Could you refer to it and try it with our latest version/fix: Aspose.Cells.GridWeb v18.3.x. If you still find any issue, kindly do create a sample project (runnable), zip it and post us to show the issue on our end, we will check it soon. Also provide steps details and screenshots to help to reproduce the issue.


#27

Hi,

Thanks for your answer,

However I’m not able to make your code work. Please consider the attached file (6.9 KB). The A1 cell of this workbook contains a list validation based on some cell values. Could you please send me back a sample project which show me that your code work on this cell ?

Thanks,


#28

@lswe,

Thanks for the template file.

I tried to accomplish the task as per the document example code but could not make it work with the cell (having list validation set on it). it seems to have some sort of clash with existing validation on the cell. I have logged an investigation ticket with an id “CELLSNET-46056” for your issue. We will look into it thoroughly and try to figure it out soon.

Once we have an update on it, we will let you know here.


#29

@lswe,

We will add support for server-side validation for list data validation. We will support server-side validation for GridValidationType.List, GridValidationType.DropDownList and GridValidationType.CustomServerFunction:
e.g
Sample code:

GridValidation gv2 = gridValidationCollection.Add(new GridCellArea(3, 3, 4, 4));
                gv2.ValidationType = GridValidationType.List;
                StringCollection sc=new StringCollection();
                sc.Add("apple");
                sc.Add("egg");
                sc.Add("banana");
                sc.Add("cake");
                sc.Add("peach");
                sc.Add("orange");
                gv2.ValueList = sc;
                gv2.ServerValidation = new myservervali2();
                gv2.ClientValidationFunction = "ValidationError2";
                gv2.InputTitle = "please select fruit";
                gv2.InputMessage = "&^**^&--which is fruit";

........



  class myservervali3 : GridCustomServerValidation
    {

        public string Validate(GridWorksheet sheet, int row, int col, string value)
        {
            if (value.Equals("egg") || value.Equals("cake"))
            {
                return "not fruit";

            }

            else
            {
                return string.Empty;
            }
        }
    }
...
in aspx page:
  function ValidationError2(cell, msg) {
             //Showing an alert message where "this" refers to GridWeb
             //  alert(this.id + msg);
           alert(msg);
           
         }

We hope to support this in our upcoming version/fix.

Once the feature is supported or we have some other update on it, we will let you know here.


#30

@lswe,

Please try our latest version/fix: Aspose.Cells.GridWeb v18.4.2

Your issue should be fixed in it.

Please refer to the code segment shared in the previous post.


#31

Hi,

Thanks for your answer,

However I’m not able to make it work. Please consider the attached file 1 (6.9 KB) I sent you on Apr 17. On load, The A1 cell of this workbook is empty but it contains a list validation based on some cell values. When I typed “1 AAA” in this cell the OnCellErrorClientFunction handler displays the correct error message and seems to restore the cell value to the previous valid value (affected in the OnCellSelectedClientFunction handler). However, if I select another cell then go back to the A1 cell, cell value became “1 AAA” which is not a correct value according to the validation as if setInnerText(cell.children[0], lastselectvalue) does not write deeply the cell value. Again, could you please send me back a sample project which show me that your code work on this cell ?

Thanks,


#32

@lswe,

Thanks for the template file and details.

Could you share the sample project (runnable) on how you write code and pop up error dialog(s), etc. to demonstrate the issue, we will check and may log an appropriate ticket(s) for the issue (if found), so it could be figured out soon.


#33

A sample project is a bit tricky for me but I can send you piece of codes :

Default.aspx

        <acw:GridWeb ID="GridWeb1" runat="server" Width="100%" Height="100%" ShowLoading="true" XhtmlMode="true"
            PresetStyle="Standard" EnableAJAX="true" EnableAsync="true" RenderHiddenRow="true"
            OncellModifiedOnAjax="cellmodifiedserver" OnCellErrorClientFunction="onCellError" OnCellSelectedClientFunction="myCellSelect"
            OnCellUpdatedClientFunction="cellupdated">
        </acw:GridWeb>

app.js

    var lastselectvalue = null;
    function myCellSelect(cell) {
        var value = this.getCellValueByCell(cell);
        lastselectvalue = value;
        console.log("myonCellSelect:" + value + " row" + this.getCellRow(cell) + ",col:" + this.getCellColumn(cell));
    }
    function onCellError(cell) {
        alert("error", 'Wrong value');
        this.setValid(cell);
        setInnerText(cell.children[0], lastselectvalue);
    }

Hope this help,

Thanks,


#34

@lswe,

I tried to accomplish the task by using my own code with existing validation in your template file but it does not work. May be it is a limitation and we cannot customize (with dialog(s)) existing validations in GridWeb. Therefore, I requested you to post a simple sample project (runnable) to show the issue, so we could evaluate based on your project with artifacts and try to figure it out soon (if possible).


#35

As you told me that it does not work on your side, why do you need a sample project ? Did you reproduce this issue and don’t know how to figure it out ? I can’t understand…

If you cannot reproduce the issue, please send me your sample project with my workbook and let me modify it to show you the issue.

Thanks,


#36

@lswe,

I have logged a ticket with an id “CELLSNET-46197” for your task/issue. We will evaluate it thoroughly and try to provide you the sample code to accomplish the task. The ticket is logged as following:

  • CELLSNET-46197 - Data validation issue - if inserting wrong value and clicking other cell does not automatically restore validation cell to its previous value.

Once we have an update on it, we will let you know here.


#37

Hi,

Any update about this issue ?

Thanks


#38

@lswe,

I am afraid your issue is not sorted out yet. Hopefully we will evaluate your issue soon.

Once we have any new information, we will let you know.


#39

@lswe

Please test with attached aspx file, it works. cellsnet-46197.zip (1.4 KB)


#40

Thanks for your anwser,

It works because you added this code :

         setTimeout(function () {
             alert("the input is invalid!");
         }, 1000); 

This is not a proper workaround because it depends on the time spend server side. I mean if OncellModifiedOnAjax event handler spend more than 1000ms the bug will be repoduce.

You can test it by yourself adding

OncellModifiedOnAjax=“cellmodifiedserver”

protected void cellmodifiedserver (object sender, CellEventArgs e) {
Thread.Sleep(2000);
}

You understand, as the spent time on server is very hard to predict I cannot use your suggested workaround.

Thanks,


#41

@lswe,

Thank you for the feedback. We are analyzing this information and will share our feedback soon.