5121 Posts in 1527 Topics by 1119 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 461 Views |
-
Custom message / error message for Save / Save and Publish

20 May 2011 at 8:44pm
After much trawling of the forums I'm still getting nowhere with this yet it seems such a basic request.
On my dataobject I'm using:
function onBeforeWrite(){
if(Director::is_ajax()) {
$dbrecord = DataObject::get_by_id("ItemInQuestion",$this->record['ID']);
if(strlen(strip_tags($this->Content)) > 100){
$this->record['Content'] = $dbrecord->Content;
}
}
parent::onBeforeWrite();
}Hopefully you can see what I'm trying to do here. I'm preventing CMS users from entering any content over 100 characters in length. Whilst this works I've no way of giving the user feed back in the case that they've entered too much text. I'd like the green or red box in the bottom left which give the response of the ajax request to read something like - 'Please keep text less that 100 characters'.
Thanks chaps.
-
Re: Custom message / error message for Save / Save and Publish

13 December 2012 at 11:15pm
do you still need the solution? took me days to figure it out but there is clean way to do this if you find out how.
| 461 Views | ||
|
Page:
1
|
Go to Top |

