views:

29

answers:

2

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="post">

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?

A: 

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.

gabe3886
Ok thanks I'll have a look into this.
Jelmar
A: 

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.

Jeepstone
Thanks. I have looked at this solution. One additional question though about Joomla's behaviour: As long as no one changes the article everything seems to go fine, its only when the article gets changed the problem occurs. So that seem ok for now, thy just have to notify me when editing. But what I would like to know is if this behaviour is also triggered when something changes on the server, or if something changes with the cache. Or: will the form stay working 'for all eternity' just so long as no one changes it? strange that the editor sometimes filters out code, and sometimes not.
Jelmar
Depending on the WYSIWYG editor you are using, it will strip out anything it doesn't like (take a look in the plugins - editors for the options). The best way would be to have their user account set to no editor, or advise them to not edit it. Alternatively, just drop your form in Chronoforms and don't worry about it.
Jeepstone
Hey thanks man, will do. Blessings, Jelmar
Jelmar