If mandatory means "must be filled in" then i've chosen the right word.
Have searched the board but with no satisfying result :(
Is is possible to alter the registration proces of new users so that they have to fill in certain fields.
And if they do not that the registration can not take place.
Or someone tells me i should upgrade my search skills ;D and points me in the right direction. For which i thank you in advance ;)
Just add a line into register.php:
under
$occupation = addslashes(get_post_var('occupation'));
add
if (!$occupation) $error .= "<li>You must fill in your occupation!";
You could as well spice this up with some JavaScript to prompt the user to fill in the mandatory fields even before (when he tries to submit the form). Edit register.php, find starttable(-1, $lang_register_php['enter_info'], 2);
echo <<<EOT
<form method="post" action="$PHP_SELF">
and replace with starttable(-1, $lang_register_php['enter_info'], 2);
echo <<<EOT
<script type="text/javascript">
<!--
function chkForm()
{
if(document.myform.user_profile1.value == "")
{
alert("Please fill in FOOBAR");
document.myform.user_profile1.focus();
return false;
}
if(document.myform.user_profile2.value == "")
{
alert("Some other alert text to tell the user he is behaving naughty!");
document.myform.user_profile2.focus();
return false;
}
}
-->
</script>
<form method="post" action="$PHP_SELF" name="myform" onsubmit="return chkForm();">
(From the back of my head, not tested though).
Users who disabled JavaScript will not see the prompt - to make this foolproof, you'll have to check as suggested by Nibbler anyway.
Joachim
Thanks for the tips. Will try at home.
Going to use this on a gallery which requires users to register with their scouting membership number.
I assume there is also a way to have a javascript check on what sort of input has been given into
a field ? For example if all characters are numbers and also check the amount of numbers.
This was also discussed on this post, which may have an extra tip for you ;)
http://forum.coppermine-gallery.net/index.php?topic=11946.msg54168#msg54168
Thanks Casper ;)
*makes mental note profile fields = user fields
But thanks for the information so far!