This topic is locked

'Error occured' when using inline Add function

8/10/2008 12:13:02 PM
PHPRunner General questions
T
thesofa author

Hi

I am using Inline Add to add a record to a slave table. There are good reasons for doing it this way rather than using a normal Add page.

I have the following code in the AfterAdd function of the Add Page

?><script>

window.open('4Letter_print.php?recordid=<?php echo $keys["id_det"]?>');

window.location.href='nd_pupils_list.php';

</script><?php


The window.open line of the script opens up a printer friendly page of a letter to go to the pupils parents, the second line of the script SHOULD redirect to the master table List page.

When I used the normal Add page, this worked.
When I save the record, either by clicking on the green tick of the inline Add or by clicking on the Save All button the following happens

The record is saved in the table but

Now I get a grey "Error Occurred" line under the first field. When I hover over it, i get a preview of the list page I should return to.

Is there something else I should be scripting the page to do as well?

When I disable the script, everything seems to work fine.
Just having the redirect to the pupils list page in the script and I get the error again, the record is saved and the preview shows the pupils_list page.
Just having the window.open for the printer page line in the script, the record is saved, the printer friendly page is opened, when closed it now shows the pupil's detentions record with all the detentions shown correctly.
So I have tried the script with just the window.open line in it and a separate redirect line as follows

header("Location:nd_pupils_list.php");

exit();


This produces a correct saved record, the printer friendly page but still the error occurred, but this time the preview from the error occurred shows the classic

Technical information Error Type 2, cannot modify header information.

If I recall correctly this error is the reason for the script I used from here in the first place.

I have looked in the help file for inline commands, but they do not seem to apply.

I would really like some help here, PHPR 4.2 build 379.
Cheers

J
Jane 8/11/2008

Hi,
don't use redirecting for Inline Edit. Just remove following line from your code.

window.location.href='nd_pupils_list.php';

T
thesofa author 8/11/2008

Hi,

don't use redirecting for Inline Edit. Just remove following line from your code.



Is there no way around this, I should like to redirect back to the kids list page after the award has been added?

J
Jane 8/11/2008

When you use Inline Add you don't need to redirect to the list page. Inline Add and edit are used on the list page directly.

T
thesofa author 8/11/2008

I was using the redirect to take the user back to the master table list page, rather than the slave table list page where the inline add was used.

J
Jane 8/12/2008

I wasn't able to reproduce this error.

Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.