We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    Has anyone else experienced problems with wlpe "remembering" the values of select, radio, checkbox inputHandler fields in the registration form when the form is refreshed due to an input error?
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 28906
      • 3 Posts
      Yes, i’ve got the some problems using WebLoginPE. Anyone figured out the problem?
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Yes, it took some hacking of the main class file. For some reason all of the code to "remember" the selected/checked settings were buried in a conditional; I just copied the relevant lines of code to just below the closing brace of the conditional so that the "remembering" code would execute all the time. For example, the block of code beginning at line 2123:

        			if ($type == 'checkbox')
        			{
        				$ph = '';
        				$ph .= '<label for="'.$DOMid.'" id="'.$DOMid.'Label"><span>'.$label."</span>\n";
        				$options = explode(',', $values);
        				foreach ($options as $eachOption)
        				{
        					$option = explode('(', $eachOption);
        					$option = str_replace(')', '', $option);
        					if (isset($CurrentUser[$name]))
        					{
        						if ($CurrentUser[$name] == 'on')
        						{
        							$ph .= $option[0].' <input type="checkbox" id="'.$DOMid.'" name="'.$name.'" checked="checked" />'."\n";
        						}
        						else
        						{
        							$ph .= $option[0].' <input type="checkbox" id="'.$DOMid.'" name="'.$name.'" />'."\n";
        						}
        					}
        					else if($_POST[$name] == "on")
        					{
        					   $ph .= $option[1].' <input type="checkbox" id="'.$DOMid.'" name="'.$name.'" checked="checked" />'."\n";
        					}
        					else
        					{
        						$ph .= $option[0].' <input type="checkbox" id="'.$DOMid.'" name="'.$name.'" />'."\n";
        					}
        				}
        				$ph .= '</label>'."\n";
        				// Set the Placeholder
        				$modx->setPlaceholder('form.'.$name, $ph);
        			}
        

        Got this stuck in right after the if (isset($CurrentUser[$name])) conditional. I did this wherever I could find any checks for the status of checkboxes; being in something of a hurry to get something into production I haven’t had the chance to go back and really go over the whole class file and fix it all.
        else if($_POST[$name] == "on")
        					{
        					   $ph .= $option[1].' <input type="checkbox" id="'.$DOMid.'" name="'.$name.'" checked="checked" />'."\n";
        					}
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org