• Hi there!

    Finally I have upgraded to phplist 3.0.12, so, I was testing it… and the problem is that I get always the message “Please check that you have entered a valid email address and try again.”

    Testing a few things I realized that the issue was having ON “Display email address confirmation field” in the phplist subcription page config…
    And that is a nice way to check that the subscribier fills it ok…

    There is no way to make that option work ok with NSU? it will be really nice…

    Best regards!
    Luciano

    https://www.ads-software.com/plugins/newsletter-sign-up/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I too have been unable to get NSU to work properly with PHPList.

    The best I got for my purposes was to use the plug-in “Shortcoder” and wrapped this code:

    <p>`<br />
    <script type=”text/javascript” language=”Javascript”>// <![CDATA[<br />
    function checkform()<br />
    {<br />
    for (i=0;i<fieldstocheck.length;i++) {<br />
    if (eval(“document.subscribeform.elements[‘”+fieldstocheck[i]+”‘].type”) == “checkbox”) {<br />
    if (document.subscribeform.elements[fieldstocheck[i]].checked) {<br />
    } else {<br />
    alert(“Please enter your “+fieldnames[i]);<br />
    eval(“document.subscribeform.elements[‘”+fieldstocheck[i]+”‘].focus()”);</p>
    <p> return false;<br />
    }<br />
    } else {<br />
    if (eval(“document.subscribeform.elements[‘”+fieldstocheck[i]+”‘].value”) == “”) {<br />
    alert(“Please enter your “+fieldnames[i]);<br />
    eval(“document.subscribeform.elements[‘”+fieldstocheck[i]+”‘].focus()”);</p>
    <p> return false;<br />
    }<br />
    }<br />
    }<br />
    for (i=0;i<groupstocheck.length;i++) {<br />
    if (!checkGroup(groupstocheck[i],groupnames[i])) {<br />
    return false;<br />
    }<br />
    }</p>
    <p> return true;<br />
    }</p>
    <p>var fieldstocheck = new Array();<br />
    var fieldnames = new Array();<br />
    function addFieldToCheck(value,name)<br />
    {<br />
    fieldstocheck[fieldstocheck.length] = value;<br />
    fieldnames[fieldnames.length] = name;<br />
    }<br />
    var groupstocheck = new Array();<br />
    var groupnames = new Array();<br />
    function addGroupToCheck(value,name)<br />
    {<br />
    groupstocheck[groupstocheck.length] = value;<br />
    groupnames[groupnames.length] = name;<br />
    }</p>
    <p>function compareEmail()<br />
    {<br />
    return (document.subscribeform.elements[“email”].value == document.subscribeform.elements[“emailconfirm”].value);<br />
    }<br />
    function checkGroup(name,value)<br />
    {<br />
    option = -1;<br />
    for (i=0;i<document.subscribeform.elements[name].length;i++) {<br />
    if (document.subscribeform.elements[name][i].checked) {<br />
    option = i;<br />
    }<br />
    }<br />
    if (option == -1) {<br />
    alert (“Please enter your “+value);</p>
    <p> return false;<br />
    }</p>
    <p> return true;<br />
    }<br />
    // ]]></script><br />
    `</p>
    <form action=”list000/?p=subscribe” method=”post” name=”subscribeform”>
    <p align=”center”><input name=”email” size=”40″ type=”text” placeholder=”Enter your email address…” />
    <script type=”text/javascript” language=”Javascript”>// <![CDATA[
    addFieldToCheck(“email”,”Email address”);
    // ]]></script>
    </p>
    <input name=”list[2]” type=”hidden” value=”signup” /><input name=”listname[2]” type=”hidden” value=”newsletter” />
    <div style=”display: none;”><input name=”VerificationCodeX” size=”20″ type=”text” value=”” /></div>
    <p><input name=”subscribe” type=”submit” value=”Subscribe” /></p>
    </form>

    If this code can somehow be incorporated into this plug-in, I think it should work nicely.

    \includes\views\form_settings – around line 24 – add:

    <tr valign="top">
                       <th scope="row">E-mail confirmation label (leave blank for none)</th>
                       <td colspan="2">
    						<input class="widefat" type="text" name="nsu_form[email_confirm_label]" value="<?php echo esc_attr($opts['email_confirm_label']); ?>" />
    					</td>
                   </tr>
                    <tr valign="top">
                       <th scope="row">E-mail confirmation value (leave blank for none)</th>
                       <td colspan="2">
    						<input class="widefat" type="text" name="nsu_form[email_confirm_value]" value="<?php echo esc_attr($opts['email_confirm_value']); ?>" />
    					</td>
                   </tr>

    \includes\NSU_Form – around line 152 – add:

    $email_confirm_label = __( $opts['form']['email_confirm_label'], 'nsu' );
    		$name_confirm_label  = __( $opts['form']['name_confirm_label'], 'nsu' );
    // adding e-mail confirmation - END
    
    <strong>\includes\NSU_Form - around line 175 - add</strong>:
    // adding e-mail confirmation - BEGIN
    		$email_confirm_type       = 'text';
    		$email_confirm_value      = $opts['form']['email_confirm_value'];
    		$name_confirm_value       = $opts['form']['email_confirm_value'];
    		$name_confirm_atts        = 'value="' . esc_attr( $name_confirm_value ) . '"';
    		$redirect_confirm_value   = $opts['form']['email_confirm_value'];

    \includes\NSU_Form – around line 217 – add:

    $output .= "<p><label for=\"$email_confirm_value\">$email_confirm_label</label><input class=\"nsu-field\" id=\"$email_confirm_value\" type=\"$email_type\" name=\"$email_confirm_value\" $email_confirm_atts ";
    			if ( ! $opts['form']['use_html5'] ) {
    				$output .= "onblur=\"if(!this.value) this.value = '$email_confirm_value';\" onfocus=\"if(this.value == '$email_confirm_value') this.value = ''\" ";
    			}
    			$output .= "/>";

    I tried to post the fix here, but it’s not displaying… I’ll try again later.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Always show invalid email message. phplist & email confirm’ is closed to new replies.