Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Changing the error message
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #1
Changing the error message
Hi,

I am working on a setup with multiple forums and I decided to reuse fields across forums.

By using language files on the new thread and edit post and using two forum specific templates I think I have made it possible to reuse 10 "standard" fields across all forums and just call them something else per forum.

The only problem I am facing is the error message (see screenshot) - if a field is not entered on a forum then the name of the field is shown as an error. I can get round that by adding a default value for each field, but it would be better if the error message did not output the name of the missing field but rather used my language file name.

Is this possible?


Attached File(s) Thumbnail(s)
   


[Image: leelink.gif]
MYBB1.6 & XThreads
04-25-2013 10:58 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Seabody Offline
Member
***
Posts: 54
Joined: Aug 2012
Post: #2
RE: Changing the error message
If I understand you correctly, in the Custom Modify Error field for that Custom Thread Field, do something like this:

Code:
<if $fid == 1 then>
{$lang->err1}
<elseif $fid == 2 then>
{$lang->err2}

etc.

04-25-2013 04:00 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #3
RE: Changing the error message
I already have a custom modify field there Seabody; but it is currently working like this:

if I set a default value then there is no warning at all;
if I set no default value but field as required then I get the field name but no custom message;
if I set no default value and field not required (just everyone) with a modify message then I get only the custom message and that does not say which field it is;

What I am looking to achieve is that if I set the modify message and field to not required (everyone) then the field name error does not show but the modify error does. Is there a language file? Then I can just use the existing forum language prefixes to set the field name the way I am doing it on new thread and editpost rather than putting it all in the modify message.

This is the current modify message

Code:
<if intval({VALUE}) < 1 or intval({VALUE}) > 5 then> 
  You must enter a value between 1 and 5. 
</if>



[Image: leelink.gif]
MYBB1.6 & XThreads
04-25-2013 04:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #4
RE: Changing the error message
If I don't misunderstand what you mean, maybe you can try something like this:
Custom Modify Error:

Code:
<if intval({VALUE}) < 1 or intval({VALUE}) > 5 then> 
  You must enter a value between 1 and 5 for the field "{$lang->my_field_1_name}".
</if>


Then in your langprefix_global.lang.php (depends on the language prefix for each forum(s)) file:

PHP Code:
$l['my_field_1_name'] = "This Field Name For This Forum";


04-26-2013 03:37 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #5
RE: Changing the error message
Thank you RateU, that indeed worked.


[Image: leelink.gif]
MYBB1.6 & XThreads
04-27-2013 04:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: