1 (edited by Markus 2006-05-15 15:08)

Topic: Can't register - "Username is a required field in this form"

Hi all.

nobody can't register at my forums anymore. even if they or i type a valid username the popup appears with the message "Username is a required field in this form". i so hope this is only JavaScript related because i have no other idea.

http://pixelpopulace.com/forum/register.php

type a username and register and you'll see what is going on. please help because this is god-awful and a turn off for visitors.

Thanks,

Markus


oh, same problem when you try to reply in the guest forum. this is great, all these days pondering: so many visits + topic vies but no one registered not even a guest forum reply. this sucks really bad.

Re: Can't register - "Username is a required field in this form"

The JS looks fine to me... odd.

Re: Can't register - "Username is a required field in this form"

<form />

?

Re: Can't register - "Username is a required field in this form"

this could be related to my top right login but i don't know what. here is the code:

<?php

// Show login if not logged in
if($pun_user['is_guest'])
{
    if(!isset($focus_element) || (isset($focus_element) && !in_array('login', $focus_element)))
    {

    // Load the language files
    require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
    require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';

    // Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)
    $redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';

    $required_fields = array('req_username' => $lang_common['Username'], 'req_password' => $lang_common['Password']);

?>
<link href="../style.css" rel="stylesheet" type="text/css">
<link href="../../../style.css" rel="stylesheet" type="text/css">
<link href="../../style.css" rel="stylesheet" type="text/css">
        <div>
            <form id="login" name="login" method="post" action="login.php?action=in" onSubmit="return process_form(this)">
            <input type="hidden" name="form_sent" value="1" />
            <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />
            <div class="font_login">Username:
            <input name="req_username" type="text" maxlength="25" class="form_login" style="height:13px" /></div>
            <div class="font_login">Password:  
            <input type="password" name="req_password" maxlength="16" class="form_login" style="height:13px" />
            <div style="padding-top:2px; padding-right:1px"><a href="register.php" class="blue_link">Register</a>   -   <a href="#" onClick="document.login.submit(); return false" class="blue_link">Login</a></div>
            <?php
                    
    }
}else
{
?>
            </div>
            </form>
            </div>
        <div style=" padding-right:10px;">
            
            <?php echo $lang_common['Logged in as'].' <br /><strong>'.pun_htmlspecialchars($pun_user['username']).'</strong>  |  <a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>'; ?>
            
        </div>
<?php
}
?>

5

Re: Can't register - "Username is a required field in this form"

First, your login form doesn't seem to have a closing </form> tag. Second, the login form uses the same names for inputs that are already being used by the registration form e.g. req_username which could be causing a problem. What I think is happening is when you submit the registration form it also acts as the submit for the login thereby triggering the error message because the login username has not been filled in. The effect of the missing </form> tag is to make it appear that the registration form and any other forms are nested inside the login form so try putting in the closing tag before anything else.

Re: Can't register - "Username is a required field in this form"

Paul wrote:

First, your login form doesn't seem to have a closing </form> tag. Second, the login form uses the same names for inputs that are already being used by the registration form e.g. req_username which could be causing a problem. What I think is happening is when you submit the registration form it also acts as the submit for the login thereby triggering the error message because the login username has not been filled in. The effect of the missing </form> tag is to make it appear that the registration form and any other forms are nested inside the login form so try putting in the closing tag before anything else.

I?ve changed the position of </form> and it helped. I had it there due to layout reasons. It?s such great hassle to get the whole thing included in that small space without things messing up.

Thanks for the quick reaction.

Cheers!