New Account Validation

From TNG_Wiki
Jump to: navigation, search

In TNGv12 and beyond, this mod uses the new guidelines for TNG v12+ cust_text.php files
If you are using TNGv12+, and any cust_text.php file in this mod is marked with a Bad Target error, you need to update your cust_text.php files before you can install this mod. [Show instructions]

If you upgraded to TNGv12+, and did not update your cust_text.php files as instructed in the upgrade readme script, then you must use the TNG Mod Manager to update them. To do so:

  1. Go to Mod Manager, and select its "Recommended Updates" tab.
    (If the "Recommended Updates" tab is not visible, then go to the Mod Manager Options tab, select "Display Settings", and turn on the "Recommended Updates" tab.)
  2. Click the "Update" button in the "Recommended Updates" tab.
    Installed mods do not interfere with the update, and if you already have (or think you may have) run this update, it will not hurt for you to run it again.

[See details in the TNGv12 Change Impacts Article][Hide the instructions]


New Account Validation
Summary Adds optional required fields and "better" form validation (plus a couple of message) to the New Account Form
Validation
Mod Updated 5 Nov 2018
Download link v12.0.0.2c
TNG 12.0

See #Revision History
Download stats
Author(s) Robin Richmond
Homepage Robin Richmond's Genealogy Database
Mod Support My Mod Support form or TNG Community Forums
Contact Developer My Mod Support form
Latest Mod 12.0.0.2c
Min TNG V 12.0
Max TNG V 12.0.2+
Files modified
newacctform.php, English cust_text.php, genstyle.css
Related Mods
Notes


Purpose of the Mod

Adds optional required fields and "better" form validation (plus a couple of message) to the New Account Form. That is,

  1. Uses a mod parameter to let the site administrator determine whether the phone, city, state, and/or notes fields are required.
  2. Re-writes the form validation routine so that all form errors are shown in one message, instead of one-at-a-time.
  3. Adds a note to the top of the form,
  4. Adds a note next to the Notes field requesting that the user specify a relative already in the database.

These two notes can be suppressed or modified through mod options.

Mod Options

  1. A string of required field names. All of the original required fields are still required. This string just lets the installing administrator make the phone, city, state, and/or comments fields required.
  2. A parameter that lets the admin suppress or change the message that goes at the top of the form.
  3. A parameter that lets the admin suppress or change the message that goes next to the notes/comments field.

Compatibility With Other Mods

Not compatible with New Account Form Mod, but is very similar. This mod's messages are different, but they can be changed by mod options.

Related Mods

  • New Account Warning adds a comment to the password field noting that the form isn't encrypted, and the user should not use a password that is used anywhere else.
  • This mod saves information that can be used by Show Mod Names, but only if the optional Show Mod Names mod is installed.

Visualizations

BEFORE As the form looks in TNG v9.2.2 through v11.1.1
New account warning-before1.png

Note also, that 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.

AFTER:
New account validation-after-v2.jpg
This mod rewrites the form validation function so that

a) Four additional fields can be required, and b) All errors are reported in one message New account validation-after-errors.png

Custom Text

The following strings are defined in the English and English-UTF8 versions of cust_test.php

# This text is placed at the top of the form.
$text['newacctintro1'] = 'An account serves only to allow you to see living people in your branch of my family tree.';
$text['newacctintro2'] = 'You must specify a relative - more recent than 1800 - to get an account.';
# This text is placed next to the notes field.
$text['acctcommentsmsg'] = 'Please include your relationship to me or to some member of my family. (Ideally, list the record ID of the person you are related to.)';
# These next 4 strings are error messages for missing required fields.
$text['enterphone'] = 'Please enter a telephone number';
$text['entercity'] = 'Please enter a city';
$text['enterstate'] = 'Please enter a state';
$text['enteremail'] = 'Please enter a valid e-mail address.';
$text['enteracctcomments'] = 'Please enter a comment with information about your relationship to me or to someone in my family';

You may modify first two message with mod options. You can modify the error messages by redefining them at the bottom of your language cust_text.php file

Revision History

Mod Version TNG Version Date Note
12.0.0.2c 12.0+ 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.2.2.2p 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.2.2.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.1 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 Richmond's Genealogy Database Robin Richmond Mod developer 9.2.2.2 11.11.1 English
MOTYER Family Genealogy John Mark Motyer Public site see here see here EN, DE, RU
Baker Family History Jon Baker Public site 9.2.2.2* 11.1.2 English
Hooley Family Links Rick Hooley Public/Private See Here See Here EN