Reputation: 1753
check out the image I have posted
As you can see I have used an Iframe.everything works fine,once I click on create pdf,there is a page that gets displayed in the iframe instead of the error.The problem arises the first time when I go to the page,since some values are missing,exceptions are thrown.
I tried adding a condition using php to check if the submit button is pressed,so that once pressed I would like the Iframe to get displayed with the result and not with the error
<?php if (isset($_POST['submit'])) {
?>
<iframe name="myframe" id="frame1" src="xm4.jsp" alt="" width="1300" height="1000">
</iframe>
<?php}?>
But this did not work.So could anyone provide me with sugestions?
Upvotes: 0
Views: 95
Reputation: 864
A very simple way around this is to hide the iframe and add a click handler to the 'Create pdf' button to show it when it is clicked.
<iframe style="display:none" id="frame1" .... />
So if you have jquery, you would do
$('create_pdf_id').click(function() {
$("#frame1").show();
});
Upvotes: 1
Reputation: 145
What exactly isn't working? Is $_POST['submit'] set on your first call, so the iframe gets displayed anyway?
You could check for the actual value of submit (if (@$_POST['submit'] == "Create PDF")).
You have to name your submit:
You could also adapt the xm4.jsp to check the required values and display a nice information rather than the error.
Upvotes: 1