Need multiple validators on Field::inst()
Need multiple validators on Field::inst()
Is there a way to combine validators on a single field?
include( "./php/DataTables.php" );
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Join,
DataTables\Editor\Upload,
DataTables\Editor\Validate;
Editor::inst( $db, 'abcauto_stock' )
->fields(
Field::inst( 'StockNr')->validator( 'Validate::minMaxNum', array(
'required' => true,
'min' => 1,
'max' => 99999999999,
'message' => 'Please enter a number between 1 and 99999999999'
))
->validator(function ($val){
//function
} ),
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
yes and you have already done it.
for some reason my minMaxNum validator when added freezes up all of my input fields after submit . And when i remove it, all input fields work again
What do you mean by "freezes up" - is there an error message from the server or something else? Can you link to a page showing the issue please?
Allan
http://www.abiapps.co.za/allan/ my test server. PLease see inline editing "freez" when
added
I'm afraid I don't see the issue. I can edit stock numbers on your page without any issue (I put them back to how they were).
The page is making a lot of Ajax requests. 2 or more per second.
Allan
Hi Allan,
Sorry, i should have specified that "stock Number" containing the validators works fine, but all of the other inputs freeze when values are changed. Concerning the 1 sec ajax calls on data refresh, i have multiple users editing data on the same datatables, a row gets a "locked" value when being edited and that row is then set to blur, to prevent other users from editing the same row, What would you suggest on the subject of realtime updates of table data, 1sec ajax calls is the only way that i was able to solve this so far, i know its putting stain on the server , but im running into deadlines, and will focus on another solution for realtime update when i have solved priority problems .
In the current table , try and change the date value of 'date on stock' , here you will see the 'freeze' with no errors, and the bubble getting stuck until exit button is pressed and no values have been changed.
There is an error - but it is coming from a field that isn't being edited, thus the error won't be shown.
When I submit an edit on the "Registration (New)" column I get the following back from the server:
However the client-side didn't submit anything for the stock number:
Could you show me the full PHP you are using please?
Allan