|
$post->set_error()
|
|
10-02-2008, 06:52 AM
(This post was last modified: 10-02-2008 07:30 AM by blueparukia.)
Post: #1
|
|||
|
|||
|
$post->set_error()
Hey.
I am playing around and I want to know how you can get those little alert boxes if something in the message is wrong. In datahandlers.php there is a set_error() function that I saw used elsewhere, but it doesn't return anything, and it requires an error code argument, and I don't know if I have to insert/register the error code somewhere, or whether I can just call it what I want. I am just playing around with the post datahandler - new post, update post and new thread, and I want to have an error occur if certain criteria is not matched when I submit a new post. So....any help would be appreciated, thanks. Josh P.S - do error messages automatically happen for quick reply (JS alert) or do you have to manually do them? P.P.S - I am hooking in through "datahandler_post_insert_post" |
|||
|
10-02-2008, 07:59 AM
Post: #2
|
|||
|
|||
|
RE: $post->set_error()
You should generally set errors in the validation step (datahandler_post_validate_post), not in the insertion hook.
The set_error function takes the langvar name as the argument, which means you need it to be set before the errors get displayed. If you don't want to load it from a language file, you can manually load in the langvar, example: PHP Code: {Who is Yumi? It's still the KFC crazed person who can't spell names properly with annoying AlTeRnAtInG CaPiTaLs in the NaMe
|
|||
|
10-02-2008, 10:12 AM
Post: #3
|
|||
|
|||
|
RE: $post->set_error()
You rock. You rock hard.
Good to see it does Javascript as well ![]() Love ya' |
|||
|
« Next Oldest | Next Newest »
|
Search
Member List
Calendar
Help






