I have been spending days to get new stuff going for my website. Bought some new plugins from IMP market and got additional scripts. One of those is a modal pop up sign up form for example. I am scratching my head on getting the form to submit the data as the regular login form does.
Apart from getting it to work, I would like to learn how it works. Have been doing some trial and error like crazy and google was not of help either.
Any help is appreciated.
This is the code from /Plugin/Usermanager/FormModel.php (below modal form)
`public static function registrationForm ()
{
$form = new \Ip\Form();
$form->setEnvironment(\Ip\Form::ENVIRONMENT_PUBLIC);
$form->addClass('ipsUserRegistrationForm');
$field = new Checkbox([
'name' => 'accept-tos',
'label' => 'I accept and understand the Terms of Use and the Privacy Policy',
]);
$field->addValidator('Required');
$form->addField($field);
$field = new \Ip\Form\Field\Hidden(
array(
'name' => 'sa', // HTML "name" attribute
'value' => 'UserManager.register',
));
$form->addField($field);
$field = new \Ip\Form\Field\Password(
array(
'name' => 'password', // HTML "name" attribute
'label' => __('Password', 'UserManager', false) // Field label that will be displayed next to input field
));
$field->addAttribute('autocomplete', 'off');
$field->addvalidator('Required');
$form->addField($field);
$field = new \Ip\Form\Field\Password(
array(
'name' => 'password_confirmation', // HTML "name" attribute
'label' => __('Password (confirmation)', 'UserManager', false) // Field label that will be displayed next to input field
));
$field->addAttribute('autocomplete', 'off');
$field->addvalidator('Required');
$field->addValidator(PasswordConfirmationValidator::class);
$form->addField($field);
$field = new \Ip\Form\Field\Captcha(
array(
'name' => 'captcha', // HTML "name" attribute
'label' => __('Prove you are a human', 'UserManager', false) // Field label that will be displayed next to input field
));
$field->addvalidator('Required');
$form->addField($field);
$form = ipFilter('User_registrationForm', $form);
$field = new \Ip\Form\Field\Submit(
array(
'name' => 'register', // HTML "name" attribute
'value' => __('SIGN UP', 'UserManager', false) // Field label that will be displayed next to input field
));
$form->addField($field);
If these come from plugins or other scripts (as you've mentioned), contact authors directly. It's hard to comment on code we have no control or experience over.
My first comment on Github, so don't shoot me...
I have been spending days to get new stuff going for my website. Bought some new plugins from IMP market and got additional scripts. One of those is a modal pop up sign up form for example. I am scratching my head on getting the form to submit the data as the regular login form does.
Apart from getting it to work, I would like to learn how it works. Have been doing some trial and error like crazy and google was not of help either.
Any help is appreciated.
This is the code from /Plugin/Usermanager/FormModel.php (below modal form)
`public static function registrationForm () { $form = new \Ip\Form(); $form->setEnvironment(\Ip\Form::ENVIRONMENT_PUBLIC); $form->addClass('ipsUserRegistrationForm');
$field = new Checkbox([ 'name' => 'accept-tos', 'label' => 'I accept and understand the Terms of Use and the Privacy Policy', ]); $field->addValidator('Required'); $form->addField($field);
$field = new \Ip\Form\Field\Hidden( array( 'name' => 'sa', // HTML "name" attribute 'value' => 'UserManager.register', )); $form->addField($field);
$builder = new FormBuilder($form); $builder ->addFields([ 'firstname' => 'First name', 'lastname' => 'Last name', ], true) ->addFields(['email' => 'Email'], true, ['Email']);
$field = new \Ip\Form\Field\Password( array( 'name' => 'password', // HTML "name" attribute 'label' => __('Password', 'UserManager', false) // Field label that will be displayed next to input field )); $field->addAttribute('autocomplete', 'off'); $field->addvalidator('Required'); $form->addField($field);
$field = new \Ip\Form\Field\Password( array( 'name' => 'password_confirmation', // HTML "name" attribute 'label' => __('Password (confirmation)', 'UserManager', false) // Field label that will be displayed next to input field )); $field->addAttribute('autocomplete', 'off'); $field->addvalidator('Required'); $field->addValidator(PasswordConfirmationValidator::class); $form->addField($field);
$field = new \Ip\Form\Field\Captcha( array( 'name' => 'captcha', // HTML "name" attribute 'label' => __('Prove you are a human', 'UserManager', false) // Field label that will be displayed next to input field )); $field->addvalidator('Required'); $form->addField($field);
$form = ipFilter('User_registrationForm', $form);
$field = new \Ip\Form\Field\Submit( array( 'name' => 'register', // HTML "name" attribute 'value' => __('SIGN UP', 'UserManager', false) // Field label that will be displayed next to input field )); $form->addField($field);
$form = ipFilter('User_registrationForm2', $form);
return $form; } `
This is the modal form as it is originally. `