Forums

Using PHP Session with chrono forms

marcusx 03 Oct, 2008
Hi everyone!

I haven't used Chrono Forms before for forms development and I just read severall very long threads in the forum but I couldn't really figure out how to do what I wan't. And if this makes sense. I use Joomla 1.5 an CF 3.0 J1.5 BETA 1

I have do build some complex interacting forms and would like to identify the user who is useing the forms over a php session to show just the data this user concerns.

As far as I know Joomla was not using any sessions in the frontend in the older versions. Has this changed in 1.5? Can I start my one session and use them inside chronoforms? It might not be possible to start a session inside the form code because the session has to be started before the first character is send to the browser. And the php inside forms might be executed after other page components are already shown.

I have to say that all this forms must be accessible for non registered users. So if there is a joomla session I could use, is it also available if knowone is logged in in the frontend.

I read in some thread that chronoforms is already using the joomla session. But this is only for checking if showing the form is alowed I think?!? Therefore I think if nobody is logged in into the front end there is also no session I can use in J1.5 or chronoforms.

Has someone done this bevore and maybe some example code? Or is the only way to set a cookie and do all the form interaction over the database.

thanks for any help
kind regards

marcus
Max_admin 03 Oct, 2008
Hi Marcus,

First of all, get V3.0 stable!

regarding sessions, I couldn't understand what you are trying to do with sessions before the form loads but to use the J1.5 sessions you need this code :


$session =& JFactory::getSession();
$session->get and $session->set



you can see the Joomla API here :
http://api.joomla.org/Joomla-Framework/Session/JSession.html

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
marcusx 27 Oct, 2008
Hi Max!

Thanks for your answer. I tried to save the post values of my testform in some session variables and reused them in several other forms - it worked quite well. Is there a reason why you normaly suggest a single form which several views (choosed via php logic) for multiform scenarios? I find it much more comfortable not to have one big monster form. Are there any clues I haven't figured out yet with my session based solution?

cheers
marcus
Max_admin 27 Oct, 2008
Hi marcus,

of course the session solution is much better and the multi form solution is coming in the next release using the session for sure but the normal PHP way because too many users will not be able to do the session way and its hard to write all the instructions for it here!

you are welcomed to show here an example form you made and I can reference users to it!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kinsh 27 May, 2010
Hello,

I am making a kinda job portal, where I need two different login forms - one for job seeker and one for employer. I have successfully created different forms. But I am not able to use them as login forms for the site. They work well but not able to use them as login forms.

I have also mapped my code so that it uses jos_users table along with my new table.

Is that a problem of session? I think I need to start a session so that it gets stored.If so, how do I do that in chronoform?
GreyHead 27 May, 2010
Hi kinsh,

You'll need to look at one of the Joomla Login forms and copy all the code over to create the login correctly.

Bob
This topic is locked and no more replies can be posted.