Joomla interaction with php script is problematic / the "action" attribute in forms
I have made a personality test. It is a set of multiple choice questions that when the user submits, gives a personality description as output.
The test questions are placed in a Joomla "Article", so the owners of the test can easily change them, and the output is then via the form handle passed to an external php script. Like this:
<form name="name" action="score.php" method="post">
Now a strange thing happens. When the owners of the test change something in the test questions, and save, the action attribute falls out. This causes the test to reset itself.
The form handle then looks like this:
<form name="name" method="pos开发者_StackOverflow社区t">
This has happened over and over again, even with multiple instances of the test. I cannot find out what this is. Does Joomla do something weird with attributes like this?
Joomla works by sending everything through the index.php page to control what certain things can do to the system.
I suggest that you look at developing the test as a module for Joomla and let site owners change the questions via parameters in the Joomla administration.
If they then want to include the test as the main content of the page, they will just need to position the module in an unused template position and include it by using {loadposition module_position}
as the content.
Yeah, you won't be able to do it just like that. The editor will strip out the code long before anything else happens.
You could try using something like http://www.chronoengine.com/component/content/article/1-latest/26-what-is-chronoforms.html which you can create a form, and then add javascript/PHP to the form itself to allow processing. You can probably take most of what you have written and place it directly into the component.
精彩评论