Hi there,
I have a form that have 2 parts, login/register.
The register part only show if the user try the social login and it's not registered yet.
I'm using a event switcher to load a Load CSS action to show/hide the div login/register
When I try the social register or enter in the login page It load perfect. The problem is if the user submit the form and have some validation problem (ie. wrong captcha, don't fill some required field...), on this case when re-load the page, the event switcher will always return "login".
As you can see in the url
Why the event switcher always return login then?
Please, help me,
Thanks in advance,
BN
I have a form that have 2 parts, login/register.
The register part only show if the user try the social login and it's not registered yet.
I'm using a event switcher to load a Load CSS action to show/hide the div login/register
<?php
if(isset($_GET['runFunction']) && !isset($form->data["loginUsername"])) //runFunction is the social function to login and the loginUsername is the field to make login (it need to be empty to register
{
echo "socialFunction".$form->data["loginUsername"]."!"; //Debug echo
return 'socialFunction';
}
else {
echo "login".$form->data["loginUsername"]."!"; //Debug echo
return 'login';
}
?>
When I try the social register or enter in the login page It load perfect. The problem is if the user submit the form and have some validation problem (ie. wrong captcha, don't fill some required field...), on this case when re-load the page, the event switcher will always return "login".
As you can see in the url
?runFunction=loginTwitterHA&chronoform=LoginFinal&event=submit runFunction is set and the echo only print login! So, loginUsername's not set.
Why the event switcher always return login then?
Please, help me,
Thanks in advance,
BN
Hi BN,
I find it hard to understand what you are doing here? Isn't is easier to use JavaScript to hide/show your div rather than CSS?
I can only guess that when the form re-loads the runFunction=loginTwitterHA is no longer in the URL, to avoid this you can set a session variable and check for that when the form resubmits. Something like this:
Bob
I find it hard to understand what you are doing here? Isn't is easier to use JavaScript to hide/show your div rather than CSS?
I can only guess that when the form re-loads the runFunction=loginTwitterHA is no longer in the URL, to avoid this you can set a session variable and check for that when the form resubmits. Something like this:
<?php
$session = JFactory::getSession();
if ( isset($form->data['runFunction']) ){
$session->set( 'runFunction', $form->data['runFunction'] ) {
}
?>
<?php
$session = JFactory::getSession();
if ( !isset($form->data['runFunction']) ) {
$form->data['runFunction'] = $session->get( 'runFunction', '' ) {
}
?>
Bob
Hi Bob,
Thanks for your reply,
I'll try it and first i'll try a js solution, you probably right, it should be easy to make in js.
But still, i'll want to understand why this happen.
BN
Thanks for your reply,
?runFunction=loginTwitterHA&chronoform=LoginFinal&event=submit this is the reload link, runFunction still on it.
I'll try it and first i'll try a js solution, you probably right, it should be easy to make in js.
But still, i'll want to understand why this happen.
BN
Hi Bob,
I found the solution, I create in JS as you suggest, I was making Responsive Template, so, I was only see CSS v.v
Thanks for your help.
Here's my solution (changed the condition to fields and not to what come in url)
BN
I found the solution, I create in JS as you suggest, I was making Responsive Template, so, I was only see CSS v.v
Thanks for your help.
Here's my solution (changed the condition to fields and not to what come in url)
<?php
if((isset($form->data["username"]) && !isset($form->data["loginUsername"])) || (isset($form->data["username"]) && isset($form->data["loginUsername"])) )
{
echo 'jQuery("div#loginFora").hide();';
}
else {
echo 'jQuery("div#registoFora").hide();';
}
?>
BN
This topic is locked and no more replies can be posted.
