Page 1 of 1
Beginner's basic Joomla form question
Posted: Thu Apr 14, 2011 12:57 pm
by Riverside
Hi, I'm a PHP hack. Don't understand the code very well, but not afraid to hack it anyway if I can.
I have a really BASIC question pertaining to the way PHP handles forms.
If a form is submitted and has either valid or invalid input, how is the page reload handled? By the form code, or externally?
I've got a contact form in Joomla. I have a specific template assigned to the form. Whenever submit is pressed, regardless of whether the form input is okay or not, the page reloads with the template assigned to the home page. I'm trying first to figure out whether it is the form code that's doing this, or some default behavior in Joomla so I know where to start looking. I want this form to always load with the same template no matter what.
Anybody?
Re: Beginner's basic question
Posted: Thu Apr 14, 2011 1:22 pm
by social_experiment
Riverside wrote:If a form is submitted and has either valid or invalid input, how is the page reload handled? By the form code, or externally?
It depends on the action of your form.
Code: Select all
<!-- will execute on itself -->
<form action="" />
<!-- will go to page.php and execute the code on there -->
<form action="page.php" />
Re: Beginner's basic question
Posted: Fri Apr 15, 2011 10:10 am
by Riverside
Thanks Social, but that's not much help. Maybe my question wasn't specific enough. I do understand that the code that loads the page can either be anywhere the programmer wants it. Except when your code is being written to work with an existing program.
This is specifically in relation to Joomla. Keep in mind that I don't even really have a decent understanding of how the core of Joomla works. The form code is a Joomla Component addon. It's a contact form. All components in Joomla interact with Joomla code. I know that much. What I don't know is whether it is Joomla, or the addon (form) that is loading the page. I don't think it is. I think it's a Joomla action that's called by the component.
I guess what I'm really asking is how Joomla handles page loads so it's somewhat more of a Joomla question than a PHP question. I was hoping somebody here might be familiar with Joomla's inner workings.
Re: Beginner's basic question
Posted: Fri Apr 15, 2011 10:23 am
by social_experiment
If it's a Joomla addon you can try contacting the creator, they will (hopefully) have an answer to your question. Remember to give them enough details about the problem

Re: Beginner's basic Joomla form question
Posted: Fri Apr 15, 2011 8:44 pm
by Christopher
Riverside wrote:I've got a contact form in Joomla.
I changed the title of your post to reflect that this is not a basic PHP form question, but a Joomla question.
Re: Beginner's basic Joomla form question
Posted: Wed Apr 20, 2011 10:42 am
by Riverside
I have actually figured this out partially, though I wouldn't say I totally understand it. Turns out it's a combination betweenhow the Joomla component extension is constructed, and the template. The problem was happening in Joomla 1.5 installation. The component was not really constructed the "Joomla way." There is a default.php file that most components include that can be used to display either the component's default view or the default template view. If that file doesn't exist in the 1.5 form component, when submit is pressed the page reverts to the default template. This component didn't have that file.
Rather than mess around trying to fix it or find a different contact component, I've decided to switch over to Joomla 1.6, which has far better template and permissions control now built into the core system. Found a different contact component with spam protection that works with 1.6. The page now behaves exactly as expected.
This works for this site. There aren't many addons compatible with 1.6, but I need very few for this site anyway so this is, for now, the perfect and least troublesome solution.