A little odd, this, but thought I would post here for a greater mind than mine to work out! The issue is with corruption displaying the backend admin panel on refresh.
Heres how it looks:
(have taken inline picture out as its too wid for the forums, please see link!)
Steps to replicate:
When editing one of my specific forms, I go to the 'formcode' tab, (make no changes) and hit apply.
This 'breaks' in chrome, IE8 and Firefox.
When I enable debugging I get the following section highlighted
With the error 'null is null or not an object'
The code in question is within the <?php> tags of the form html, and functions without error when the form is used!
I am just about to test creating a brand new form ith just the above code to see what happens!
Cheers,
/Miz
Heres how it looks:
(have taken inline picture out as its too wid for the forums, please see link!)
Steps to replicate:
When editing one of my specific forms, I go to the 'formcode' tab, (make no changes) and hit apply.
This 'breaks' in chrome, IE8 and Firefox.
When I enable debugging I get the following section highlighted
<span class="syntaxdefault"><br /> </span><span class="syntaxkeyword">$(</span><span class="syntaxstring">'uname'</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">addEvent</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'blur'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> function</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault"> e </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> new Event</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">stop</span><span class="syntaxkeyword">();<br /><br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment">// Show the spinning indicator when pressing the submit button... <br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">$(</span><span class="syntaxstring">'indicator1'</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">setStyle</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'display'</span><span class="syntaxkeyword">,</span><span class="syntaxstring">'block'</span><span class="syntaxkeyword">);<br /><br /></span><span class="syntaxdefault"> var username </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">$(</span><span class="syntaxstring">'uname'</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">value</span><span class="syntaxkeyword">;<br /></span><span class="syntaxdefault"> if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> username </span><span class="syntaxkeyword">!=</span><span class="syntaxdefault"> </span><span class="syntaxstring">''</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault"> var url </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxstring">'index2.php?option=com_chronocontact&chronoformname=ajax_form&username='</span><span class="syntaxkeyword">+</span><span class="syntaxdefault">username</span><span class="syntaxkeyword">+</span><span class="syntaxstring">'&tmpl=component'</span><span class="syntaxkeyword">;<br /><br /></span><span class="syntaxdefault"> new Ajax</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">url</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault"> method</span><span class="syntaxkeyword">:</span><span class="syntaxdefault"> </span><span class="syntaxstring">'get'</span><span class="syntaxkeyword">,<br /></span><span class="syntaxdefault"> onSuccess</span><span class="syntaxkeyword">:</span><span class="syntaxdefault"> parseResult<br /> </span><span class="syntaxkeyword">}).</span><span class="syntaxdefault">request</span><span class="syntaxkeyword">();<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault"> function parseResult</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">request</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">$(</span><span class="syntaxstring">'indicator1'</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">setStyle</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'display'</span><span class="syntaxkeyword">,</span><span class="syntaxstring">'none'</span><span class="syntaxkeyword">);<br /><br /></span><span class="syntaxdefault"> var msg </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> request</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">split</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'##@##'</span><span class="syntaxkeyword">);<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">$(</span><span class="syntaxstring">'username_msg'</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">setHTML</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">msg</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">1</span><span class="syntaxkeyword">]);<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">}<br /><br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">});<br /></span><span class="syntaxdefault"> </span>
With the error 'null is null or not an object'
The code in question is within the <?php> tags of the form html, and functions without error when the form is used!
I am just about to test creating a brand new form ith just the above code to see what happens!
Cheers,
/Miz
Confirmed - the error can be duplicated with the following simplified form (backup included as attachment).
http://dev.carsavingexpert.com/index.php?option=com_chronocontact&chronoformname=backend_test
To verify that the form is working, try typing 'Mizpah' as the user, vs any username, you will see available/taken status update via an ajax call - so the code that errors at the backend, works at the frontend!
http://dev.carsavingexpert.com/index.php?option=com_chronocontact&chronoformname=backend_test
To verify that the form is working, try typing 'Mizpah' as the user, vs any username, you will see available/taken status update via an ajax call - so the code that errors at the backend, works at the frontend!
Hi,
This is a fairly well-known issue, and I believe Max is working on a solution(?). It is caused by ChronoForms trying to figure which form fields are present in your form, and would be most present when you use the apply button (for me, the malformed backend only appears after using the Apply button. Using Save and then re-opening the form shows it perfectly fine).
In this case, your php-code gets executed in order to be parsed, once the form input's are known the generated data is dumped. Unfortunately, by then the $doc->addScriptDeclaration() method has already been invoked, and your code ends up in the backend page. A workaround here would be to test if you really are in frontend before adding the javascript delcaration:
There is another version of this issue, where the form code has unbalanced tags - which in it's turn causes some browsers to "close" the textarea input early, injecting subsequent form data into the backend page. The above workaround will not work in this case however. Only wellformed form data will help here...
/Fredrik
This is a fairly well-known issue, and I believe Max is working on a solution(?). It is caused by ChronoForms trying to figure which form fields are present in your form, and would be most present when you use the apply button (for me, the malformed backend only appears after using the Apply button. Using Save and then re-opening the form shows it perfectly fine).
In this case, your php-code gets executed in order to be parsed, once the form input's are known the generated data is dumped. Unfortunately, by then the $doc->addScriptDeclaration() method has already been invoked, and your code ends up in the backend page. A workaround here would be to test if you really are in frontend before adding the javascript delcaration:
<? $script = ".....
...";
global $mainframe:
if ($mainframe->isSite())
{
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($script);
}
?>
There is another version of this issue, where the form code has unbalanced tags - which in it's turn causes some browsers to "close" the textarea input early, injecting subsequent form data into the backend page. The above workaround will not work in this case however. Only wellformed form data will help here...
/Fredrik
Thanks Fredrick!
As I only just started having the issue occour I assumed it was somthing nefarious that I was doing with my form! I appreciate the workaround🙂
As I only just started having the issue occour I assumed it was somthing nefarious that I was doing with my form! I appreciate the workaround🙂
Hi both,
Yes this is a complete nuisance. The back-end check is a neat workaround (but it is a workaround that shouldn't be needed). $mainframe->redicrect is another killer as it stops the form saving :-( The same fix would work there.
Generally you can still work with the misplaced tabs as though they were in the correct location.
Bob
Yes this is a complete nuisance. The back-end check is a neat workaround (but it is a workaround that shouldn't be needed). $mainframe->redicrect is another killer as it stops the form saving :-( The same fix would work there.
Generally you can still work with the misplaced tabs as though they were in the correct location.
Bob
Just to confirm, the workaround works like a charm!
PS: And just to be a pain in (censored) - In the forums wide images seem to go into a div and scroll, but wider than they should for the layout - probably another one for the todo list!
PS: And just to be a pain in (censored) - In the forums wide images seem to go into a div and scroll, but wider than they should for the layout - probably another one for the todo list!
This topic is locked and no more replies can be posted.