vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Require Form Input (https://vborg.vbsupport.ru/showthread.php?t=123245)

TruthElixirX 08-06-2006 09:35 PM

Require Form Input
 
My knowledge of HTML escapes me and google was of no help.

How do I make a field on a form required? >.>

Guest190829 08-06-2006 09:39 PM

Quote:

Originally Posted by TruthElixirX
My knowledge of HTML escapes me and google was of no help.

How do I make a field on a form required? >.>

Well you can't do that with HTML alone, you would need to use PHP or Javascript.

TruthElixirX 08-06-2006 09:45 PM

Quote:

Originally Posted by Danny.VBT
Well you can't do that with HTML alone, you would need to use PHP or Javascript.

Ah, any links or instructions to point me in the right direction?

Maybe vB already has this built in? I am doing this on a vB board.

aggiefan 08-06-2006 11:40 PM

This will make it show up in a standard error message from vbulletin.

Put it after the submit button action.

Code:

if ($formanswer == '')
{
$errormessage="you need to answer this question since it's required";
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
        exit();
}


TruthElixirX 08-06-2006 11:47 PM

Quote:

Originally Posted by aggiefan
This will make it show up in a standard error message from vbulletin.

Put it after the submit button action.

Code:

if ($formanswer == '')
{
$errormessage="you need to answer this question since it's required";
eval('print_output("' . fetch_template('STANDARD_ERROR') . '");');
        exit();
}


How do I apply this to a specific field?

Abe1 08-07-2006 01:16 AM

Quote:

Originally Posted by TruthElixirX
How do I apply this to a specific field?

It can't. This would stop the user from going further but giving them an error when tey click submit.

TruthElixirX 08-07-2006 10:53 PM

okay.. so.. I'm more confused now then when I started...

Guest190829 08-07-2006 10:56 PM

Javascript Tutorial:

http://www.javascriptkit.com/javatutors/form6.shtml

For php it's just checking if a variable is empty.

TruthElixirX 08-09-2006 07:51 PM

Quote:

Originally Posted by Danny.VBT
Javascript Tutorial:

http://www.javascriptkit.com/javatutors/form6.shtml

For php it's just checking if a variable is empty.

Thank you Danny!


All times are GMT. The time now is 07:02 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.02653 seconds
  • Memory Usage 1,726KB
  • 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
  • (2)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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