Author Topic: Validations - Required vs Warning  (Read 4924 times)

rgorantla

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Validations - Required vs Warning
« on: September 29, 2014, 08:35:28 pm »
Hi,

we like the way the tool tip shows upon validation.
Is there a way to just give a warning and accept values(in a tool tip)  rather than making it as a required validation and ignore?

I did this as a popup but as per my requirement - they like the way the tooltip shows, so they want it to be a warning in atooltip for few cells.

Appreciate your help.

Thanks,
Roseline

rgorantla

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Re: Validations - Required vs Warning
« Reply #1 on: October 02, 2014, 07:25:06 pm »
Hi,

Could you please tell me if there is any possible way ?

This is an imp feature that needs to be implemented in our project.

Thanks,
Roselien.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Validations - Required vs Warning
« Reply #2 on: October 02, 2014, 11:32:43 pm »
Please check this demo http://paramquery.com/pro/demos/editing_custom2 for books column

and take note of editorKeyUp event ( implemented to display popup as warning ) and beforeValidate event ( implemented to allow invalid values ).

rgorantla

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Re: Validations - Required vs Warning
« Reply #3 on: October 07, 2014, 12:57:40 am »
Hi,

It is not working the way i want.

1st time, when you put invalid cell it takes and hit tab it goes to next cell.
But if you come back to this cell again , it wont let you go to another cell unless you enter again something in that cell (ex: books) - it is happening in the demo too in books column ... can we do something for this?

Is there any way to show the warning message when you hover the cell that have invalid values ?

« Last Edit: October 07, 2014, 12:59:46 am by roseline.gorantla »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Validations - Required vs Warning
« Reply #4 on: October 07, 2014, 11:52:49 pm »
That is not supported currently, might be added in the next release.
« Last Edit: October 07, 2014, 11:55:35 pm by paramquery »

rgorantla

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Re: Validations - Required vs Warning
« Reply #5 on: October 12, 2014, 01:11:37 am »
For this to work , i put the warnings in render field - Please see below : But the problem is if we have 1 row which has data and it has been rendered , whenever we click add new row /delete row or anything - alerts are popping up everytime !! I really need this working - Please advise.

  render: function (ui) {
        //debugger;
        var cellData = ui.cellData;
        if (cellData != null) {
            var value = ui.rowData.contreeplus2;
            var ratevalue = ui.rowData.rateeepluschildren;
            var celvalue = ui.cellData
            if (value > celvalue || ratevalue < celvalue) {
                alert("Higher Than expected");
                return "<div class= 'yellow'>" + "$" + parseFloat(ui.cellData).toFixed(2) + "</span>";
            }
            else {
                return "$" + parseFloat(ui.cellData).toFixed(2)
            }
        }
        else {
            return "";
        }
    }

Thanks,
Roseline.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Validations - Required vs Warning
« Reply #6 on: October 13, 2014, 11:18:16 pm »
render callback is called whenever cell, row or whole view is refreshed, so putting an alert in render is not a good idea, it would lead to unwanted alerts.

Probably you could use a jQueryUI tooltip to display warning message by adding a title attribute in the rendered cell.

In the render callback

if validation fails then

 return "<div title='validation message'>"+ui.cellData+"</div>";

and in the $(function(){
  //add $(document).tooltip();
  $(document).tooltip();
});

rgorantla

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Re: Validations - Required vs Warning
« Reply #7 on: October 13, 2014, 11:36:19 pm »
Is there any way to add tootltip like we add class

Ex:  $grid.pqGrid("addClass", { rowIndx: rowIndx, dataIndx: dataIndx, cls: 'yellow' });
« Last Edit: October 16, 2014, 12:27:30 am by rgorantla »