It's possible to debug pl/sql dynamic action without output to js console in oracle apex? - plsql

I want to output action variable in run-time, now i can only write to page item and output value by js, can i output variable value without js

Related

passing a parramter from php to javascript back to php

I have a php page, which using javascript, creates a popup window which contains another php page. the php page in the popup window is basically a form, and will use that value to insert into a database. Using the following function to load the php page in a popup:
phppopup('edit_status.php?cmd=EditStatusData')
function phppopup(page){
child1 = window.open (page, "Ebay Auctions", "height=600,width=600,status=yes,toolbar=no,menubar=no,location=no");
child1.document.close();
}
How can i pass a value from the calling page to the page in the popup?
I am trying at the moment:
echo "<p>Edit User Info
<p>Historie;
Which generates the following html:
Edit User Info
</strong></strong></strong></strong></p><p><strong><strong><strong><strong>Historie
It works fine for updateByEdit, why not for phpopup?
$pk is just an integer, which display fine in the page it the window is called from.
Well, you're already doing it - the GET variable in edit_status.php will have one entry, with key='cmd' and value='EditStatusData'. Just pass as many parameters as you need (while being mindful that such data will be publicly viewable).
Just add the arguments as part of the get request:
phppopup("index.php?var1=value1&var2=value2"); // Get
etc.
Alternatively, for passing it arguments when it is open already, use the handle that is returned (child1) and access that window's DOM via javascript.
child1.document.getElementById("myelement").innerHTML = "Hello World"; // Parent Child
If you have trouble with this, get the child window to trigger a callback in the parent window via window.opener when the child document has loaded, e.g.
window.opener.myCallback(requestedinfo); // Parent window callback function
I noticed that the generated HTML contains a query string that has HTML entities ('& amp;') instead of their actual equivalents. Make sure that updateByEdit(...) isn't returning entities or the query string won't be printed correctly.

php parse javascript generated text

let's say that on some site there are some div elements, which content is generated by javascript. I want to code a PHP script, that will get that content and store it to some variable. I know how to parse text using PHP, I just don't know how to get to the javascript generated output (not JavaScript code!) and store it to PHP variable. Any ideas?
You could post the HTML back to your PHP script. Assuming that the javascript code fills out an element with id="foo"...
var generatedHTML = document.getElementById('foo').innerHTML;
Then you could use whatever AJAX library you might have (eg: jQuery) to post it to a server for processing.
(Or you could process it on the client side..!)

How to pass a variable from php to a modal

Initially, as can be seen in this unsuccessful attempt: Undefined index error when sending variable from jquery to php and this unsuccessful attempt:Passing Jquery variable to php within a modal
I was trying to pass a variable from php, to jquery and back to php.
Basically I am generating images form a database in a php loop. When the user selects an image, I want the id of that image to be passed to the modal so that I can query the database again (based on that id) and get more information.
Is there another way of doing this other than the methods outlined in the posts above. For some reason those do not return the result.
The difference between Send PHP variable value to JavaScript popup window in same page and my question is that I want it as a heading.. and as a variable so I can query the database again. I am not using this to input values into a form

using session value as filter value on creation of jquery datatables

I am using jQuery datatables in a dynamic PHP site. I have a page "dashboard.php" with a simple search field on it. when I submit that form the search term is set to session variable then I am sent to a page that builds a datatable using "server-side data" (php). I am trying to get the session['searchTerm'] to be set $("#el_id").val(val); in the filter box, so it will filter the results if there is a term (session var) set. I am at a loss, I have tried all I can think of. Is it possible?
You can trivially embed it in the "sent to a page" location when that page is generated:
var searchTerm = <?php echo json_encode($_SESSION['searchTerm') ?>;
Since the session value was set in the PREVIOUS page load, it'll be available to this new page when it's loaded, and you can output it directly into the javascript on that page. Note that I'm passing the value through json_encode, which ensures that no matter what the content of this searchTerm is, it'll be syntactically valid javascript. If you were going to embed the term into a hidden form field, you'd use htmlspecialchars() instead.

Rely on javascript to execute PHP script or manipulate hidden form elements and rely on PHP?

I wrote a JavaScript script that swaps two selected img tag src values.
The point is to let the user rearrange a list of images.
For sending the new order to a PHP script, I have two ideas:
Have a button execute a JavaScript function that gathers the new order of images into an array of URLs. Then, rely on JavaScript to send the data to a PHP script?
Have the initial JavaScript rearrange hidden input tag value attributes which would contain data such as a URL and order number. Then, rely on a submit input button to execute a POST request without JavaScript?
Thanks!
Why not consider using Jquery's UI Draggable/Sortable? It takes some of the brain damage out of the code and gives the user an intuitive way to interface with the reordering process:
http://jqueryui.com/demos/draggable/#sortable
You could then use the callbacks to update via Ajax, or set variables that could be dumped to PHP on submit.

Resources