New Account Validation

From TNG_Wiki
Jump to navigation Jump to search
New Account Validation
Summary Adds optional required fields and "better" form validation (plus a couple of message) to the New Account Form
Mod Updated 28 Jan 2023
Download link
TNG 14.0
TNG 13.0
Download stats
Author(s) Robin Richmond
Homepage This page]
Mod Support My Mod Support form
Contact Developer My Mod Support form
Latest Mod
Min TNG V 12.0
Max TNG V 14
Files modified
newacctform.php, admin_genconfig.php, admin_updateconfig.php
Related Mods

Purpose of the Mod

Adds optional required fields and "better" form validation (plus a couple of message) to the New Account Form. That is, |}# Uses a mod option to let the site administrator determine whether the phone, city, state, and/or notes fields are required.

  1. Re-writes the form validation routine so that all form errors are shown in one message, instead of one-at-a-time, and that the missing required filed are highlighted in red.
  2. Adds optional notes to the top and/or bottom of the form. The note text can come from a mod option or from custom text strings.

Mod Options

These mod options are custom TNG settings, defined and edited in a Mod Settings Block in the form at Admin>>Setup>>General Settings, in a new subform named Mod Settings Blocks. The Mod Settings Blocks mod is a prerequisite for the installation of this mod. [TNGv12 considerations]

  • Most of my TNGv12 mods use classic Mod Manager Parameters rather than Mod Settings Blocks (if they have options at all). Those mods require no special installation considerations.
  • A few of my TNGv12 mods use Mod Settings Blocks, but the TNGv12 Mod Settings Blocks code is installed with the mod, not as a separate mod. And, in TNGv12, the Admin>>Setup>>General&nsbp;Settings subform for Mod Settings Blocks is titled "Robin's Mods". See details in the Installation section below.
[Hide TNGv12 considerations]
  • Required fields - A set of checkboxes that allow most of the fields in the form to be marked as required.
  • A group of fields that determine how the configurable message for the top of the form will be defined. The primary selection here is between a radio button set with two choices:
    1. Use the text defined here in the mod options
      • A subordinate textarea field specifies the message text to be used no matter what language the end-user selects.
      • The mod defines default message text for two message. Right next to the textarea field, a small button labeled with 'D' (for Default) allow you to restore the default text.
    2. Use the language string $text['rrnav-toptext']
      • This language string can be defined for as many languages as the you want. If no string is defined for a given language (other than English-UTF8), the English string will be used. Thus if it is possible for a user on site to select a language for which you have not specified a string. and you want a message to be displayed, then define $text['rrnav-toptext'] in English. And if English-UTF8 is a site option (and, again, if you want a message to be displayed), you must define the English-UTF8 string.
      • Each language's text string must be defined (like other site-specific language strings) in the language's cust_text.php file. In most case, the strings should be defined at the bottom of the cust_text.php file.
  • An identical group of fields that determine how the configurable message for the bottom of the form will be defined. The text string associated with the second radio button is $text['rrnav-bottomtext'].

Compatibility With Other Mods

  • v13.0.0.4e of this mod is compatible with Password Generator
  • This mod is not compatible with New Account Form Mod, which serves the same general purpose, but which is not as flexible as this mod. This mod also distinctly improves the way that users are informed when required fields have no value.

Related Mods

  1. New Account Warning is related in that it also affects the New Account Registration form. If the page uses http rather than https, it adds a comment to the password field noting that the form isn't encrypted and that the user should not use a password that is used anywhere else.
  2. The Mod Settings Blocks mod packages this mod's options into what I call a "Mod Settings Block", which is a set of form fields that formatted and labeled so that it stands out among other options in an Admin>>Setting form. The Mod Settings Blocks is a prerequisite for this mod; it must be installed before this mod can be installed.


This mod does not use standard cust_text.php files for language strings. Instead, it stores languages strings in the mod's subfolder, and pages modified by this mod load language strings directly from files in the mod's languages/ subfolder. Read more about this technique and its procedure for handling site-specific language string overrides.

[Show Installation Details]


  • A working TNG installation.
  • An installed current version of the Mod Manager.
  • You should backup files listed in the panel on the right.


  1. Remove and delete previous version of this mod.
  2. Backup the files updated by this mod. They are listed in the panel at the upper right.
  3. Download the .zip file, Extract its .cfg file to the mods folder.
  4. Follow the normal automated installation for Mod Manager, as shown in the example Mod Manager - Installing Config Files.


  1. Try using the Mod Manager Remove capability
  2. Contact me through My Mod Support form.
[Hide Details]


The fields required by the native program are marked with an asterisk.
New account warning-before.jpg
  1. The custom message at the top of the form is highlighted
  2. The required fields that have been selected in the mod options are marked with an asterisk and with the placeholder 'Required'
  3. The custom message at the bottom of the form is highlighted.
New account validation-after.jpg
Form field error messages

With the pristine code, the form validation routine displays only the first error it encounters. When the user corrects that error and resubmits, the form validation routine might then display a message about a different error. This mod rewrites the form validation function so that it tells you how many required fields are missing and defines a red border around each missing field.
New account validation-errors.jpg

The Mod Settings Block

A Mod Settings Block is an outlined subform within an Admin>>Setup program that contains the options for a single mod. What is most notable about a Mod Settings Block is that a hyperlink directly to a Mod Settings Block displays only that block (i.e. only one mod's options), not all of the other options in the form or subform.

Here, you see the this mod's Mod Settings Block, in admin_genconfig.php, at Admin>>Setup>>General Configuration. The triangular arrow next to the subfolder heading Mod Settings Blocks is pointing to the right, meaning that the subform is not open, and that your site's other mod settings blocks are not visible. If you were to open the subform by clicking on the heading, you would see the mod settings blocks for other mods that you have installed.

New account warning-msb.jpg

Revision History

Mod Version TNG Version Date Note 14 28Jan2023 No functional changes. Upgraded to TNGv14 13.* 3 Jan 2022 Established compatibility with Password Generator 13.* 21 Dec 2020
  • Eliminated a "headers already sent" PHP error that shows up only very rarely.
  • Better slash-quoting of the message text in the mod options. 13.* 29 Sep 2020 12.* 5 Nov 2018 v2a was not compatible with TNGv12.0.2; I'm not actually sure what was wrong with v2b; there may simply have been problem with the uploaded file. 9-11.1.2 1 Oct 2018 No functional changes; changed the cust_text.php search string so that this version of the mod is compatible with TNGv9.2.2. through TNGv11.1.2. 9.* 21 Feb 2016 Changes include:
  • Ken Roy fixed a bug for me. It wasn't turning off <strong> at one point.
  • The mod now puts the word "Required" as a placeholder in all required fields (not just the optional ones), and removes the old message saying '* Required field'
  • Moves the Notes/Comments message below the field when in mobile mode.
  • A new style rule (in genstyle.css):
    • Puts a mininum width on the first column of the form layout table to make sure that the form prompts column is not forced to be too narrow by the Notes/Comments message.
    • Right-justifies the form prompts 9.2.2 - 10.1.3 21 Feb 2016 New mod, with most of its functionality taken from New Account Warning v3.

Sites using this mod

If you download and install this mod, please add your site to the table below.

URL User Note Mod-Version TNG-Version User-language
Robin's Roots Robin Richmond Mod developer 14 EN
Baker Family History Jon Baker Public site* 11.1.2 EN
Hooley Family Links Rick Hooley Public/Private See Here See Here EN
The Cole / Tanner Family Tree David Cole Public/Private see here see here EN, DE, FR, ES, NL
Bastiaanssen Genealogy Jan Bastiaanssen Public / Private 13.1.2 EN, NL, ES
Your Roots are Showing Harold Craswell Public/Private See Here See Here EN
Van Peer Project Drew McClenaghan Private 12.3.0 EN