Forums

Form id and name change

ralfeez 28 Jul, 2010
I have searched through dozens of posts, but I have not found exactly what I am looking for. I apologize if this has been covered in the past. I am attempting to add a name and id for my form that needs to be very specific. Currently the component adds "ChronoContact_" as a prefix to any name selected for the form. This won't work for me. Do I need to change the native code to eliminate this feature or is there a configuration setting that will fix this for me?
thank you,
Ralph
GreyHead 28 Jul, 2010
Hi Ralph,

Not without hacking the code in several places (and maybe not then).

Why do you need this Id? Maybe there is another solution.

Bob
ralfeez 28 Jul, 2010
Well GreyHead, I will be honest, I was hoping that it would be easy. I am just grasping at straws at this time trying to solve an issue with one of my new forms. In an attempt to pass values to the login form, I was hoping that it may be triggered by a watch for the form id. The URL of the restricted page being requested needs to be passed to the login form so that after login has been confirmed, the user returns to the page that had been previously requested.
Any info will help,
Thank you,
Ralph
GreyHead 28 Jul, 2010
Hi Ralph,

You can set the return URL of the Joomla Login dynamically.

Try this code at the beginning of the Form HTML
<?php
if ( !$mainframe->isSite() ) { return; }
$user =& JFactory::getUser();
if ( !$user->id ) {
  $uri =& JFactory::getURI();
  $return = $uri->toString();
  $return = "&return=".base64_encode($return);
  $mainframe->redirect('index.php?option=com_user&view=login'.$return);
}
?>


Bob
ralfeez 28 Jul, 2010
Yes Bob, that is initially what I had tried, but it bombs out with an error:

The page isn't redirecting properly.
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

thank you,
Ralph
GreyHead 28 Jul, 2010
Hi Ralph,

I just tested it and It's OK on my plain vanilla Joomla site. There might be problems if you have SEO URLs I guess.

Bob
ralfeez 28 Jul, 2010
Bob,
No the SEO URls are turned off, so it is not that. I will keep looking thanks. I am sure that it is able to be solved, but it is really frustrating me.
Ralph
ralfeez 28 Jul, 2010
Bob,
Maybe I misunderstood what you want to do with the code listed above. Are you saying to place it in the Forms Code above the html for the form? If so, how will the form be seen? won't this code redirect before the form is written to the browser?
thank you,
Ralph
GreyHead 28 Jul, 2010
Hi Ralph,

Yes, it goes at the beginning of the Form HTML.

It will redirect only if the user isn’t logged in.

Bob
ralfeez 28 Jul, 2010
Okay you don't understand what I am trying to do. The form is a replacement for the login and the registration form. The form will only show if the user is not logged in. Then I want it to redirect to com_user and log them in. When the log in is successful, they will return to the page that they originally wanted to see which is restricted.
thanks,
Ralph
GreyHead 28 Jul, 2010
Hi Ralph,

OK, in that case I'd use Jumi to put the code in a hidden module on the restricted page. Then you need to (a) add code to the Form HTML to capture the 'return' parameter in a hidden field and (b) in the OnSubmit Code box set the from reDirect URL. It needs a couple of lines for each part.

If you need it I can work out the code in the morning (it's midnight now and I'm closing down).

Bob
ralfeez 29 Jul, 2010
Thank you for the support. I managed to work my way through it. It was far more complicated that I had anticipated.
thanks,
Ralph
This topic is locked and no more replies can be posted.