vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   [SOLVED] Error Message in newthread form (https://vborg.vbsupport.ru/showthread.php?t=296543)

omardealo 03-26-2013 06:05 PM

[SOLVED] Error Message in newthread form
 
Hello ...

I add new filed in newthread form , this field will contain only numbers
i know how show filed in newthread template and save data in database

PHP Code:

$this->validfields['user_contact'] = array(TYPE_STRREQ_NO); 


but i want know how i make this filed (user_contact) Necessary and show erorr massage if user not entry anything Or user entry letters, not numbers ...
like Error message thread title
PHP Code:

you must enter a title subject 



Thanks !

kh99 03-29-2013 06:35 PM

You could try changing "REQ_NO" to "REQ_YES" and see if that does what you want.

omardealo 03-29-2013 07:10 PM

1 Attachment(s)
i changing it in threadfpdata_start hook
PHP Code:

 $this->validfields['user_contact'] = array(TYPE_STRREQ_YES); 

Nothing happened , that's not i want
I want to make sure that the user writes the content in this field, and this field accepts numbers only
If the user does not fill the field number, stop the process of sending new thread OR stop editing the thread and shows him a message (There is an empty field and you must fill number)

like this photo in attachment

omardealo 03-30-2013 09:08 PM

OKay ... I finally found the solution

hook : newpost_process

PHP Code:

if ($type == 'thread')
       {
// check the data of filed (Content is not empty and also only numbers)
if (! is_numeric ($vbulletin->GPC['user_contact']) || $vbulletin->GPC['user_contact'] == ''
    {
// Here is the error message
$dataman->error('user_contact_msgerror');
}else{
$dataman->setr('user_contact'htmlspecialchars_uni($post['user_contact']));
     }
 } 


Thank you , kh99


All times are GMT. The time now is 10:22 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01589 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete