load login as light-box, after login autoclose and pass data to form

sortby 16 Aug, 2015
Hello,
I have build a form in CF5 where in the end some fileds (quick custom registration fields) are available only for NOT logged in user (made by Php IF on user->guest). And it works like a charm!
Now I would ask with a link if they are already registered (but not logged) so I have build a custom code to load another form where they can log in (used this faq for fancybox), in this form I have used the joomla login from chronoform. And it works as well.

This is my custom code inside the form as reference (this actually works...prob not the best code but works๐Ÿ™‚ )
<?php
$user = JFactory::getUser();
if ($user->guest) {
 
		echo "<div class='form-group gcore-form-row' id='form-row-text11'><div class='gcore-input gcore-display-table' id='fin-text11'><input name='text11' id='text11' value='' placeholder='Inserisci la tua email ' class='validate['required','email'] form-control A' title='' style='' data-inputmask='' data-load-state='' data-tooltip='' type='text' /></div></div>

<div class='form-group gcore-form-row' id='form-row-password'><div class='gcore-input gcore-display-table' id='fin-password'><input name='password' id='password' value='' placeholder='inserisci la tua password' class='validate['required'] form-control A' title='' style='' data-load-state='' data-tooltip='' type='password' /></div></div>";

JHtml::_('behavior.modal'); 
$jdoc = \JFactory::getDocument();
$style = "#modal_a {display: inline; position: relative;}";
$jdoc->addStyleDeclaration($style);
?>
<div>Some text here <a class="modal" id='modal_a' href="index.php?option=com_chronoforms5&chronoform=login-prova" rel="{handler: 'iframe', size: {x: 600, y: 450}}" >open form</a> more text here.</div>
<?php
					}
else {
		
$form->data['user_id'] = $user->id;
$form->data['text11'] = $user->email;
$form->data['password'] = $user->password_clear; 
	}
?> 



The lightbox is called and open correctly...login as well works...BUT...here my questions:


1- How to auto-close the light-box automatically after the login is successfull ?
2- pass data/info (user login and pass) to the main form data?
3- and make it works also the initial check on user status ...so hiding the two fields of initial registration


some my idea:
1 - using some custom js after success login...but which?
2 - using data to session or session to data...but how?
3- I was thinking about a loop...but in that case it clean all the user checks...

I know my questions are quite articulated so if you have another method (more simple..or more stable) to achieve the same result I'm happy to consider.

Thanks in advance ๐Ÿ˜‰
sortby 18 Aug, 2015
Hi,
any suggestion on my topic?
Thanks in advance ๐Ÿ˜‰
Max_admin 27 Aug, 2015
You may need to use some JavaScript and AJAX code to achieve this, the code is dependent on the elements you have on page so I can't give examples.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.