rudyten
-
Posts
48 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Downloads
Gallery
Store
Posts posted by rudyten
-
-
I am playing with a simple example where I have a 2 pages
One page is a simple Form page. That uses jQuery submit() to fire up an alert ("yayyy for summitted") when the form is submitted.
Page two, places this form in an iframe and loads it into a jQuery Dialog that has a SAVE and CLOSE button
I want to be able to trigger the form Submit using the SAVE BUTTON in the Dialog.
Since the form is in a iframe, I have no idea how to successfully fire up that alert ("yayyy for summitted").
Been stuck on this for a couple of days. So some help would be nice, thanks...Dialog Page
<!DOCTYPE html> <html> <head> <title>iframe in Dialog</title> <link rel="Stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" /> <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"> </script> <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"> </script> <script type="text/javascript"> $(document).ready(function () { $('a#pop').on('click', function (e) { e.preventDefault(); var pagetitle = $(this).attr("title") var page = $(this).attr("href") var iframe = $('<iframe id="myiframe2" style="background:#EEE9E7; border: 0px; " src="' + page + '" width="100%" ' + 'height="100%"></iframe>'); var dialog1 = $('<div></div>').append(iframe).appendTo('body').dialog({ autoOpen: false, modal: false, height: 625, width: 500, title: pagetitle, close: function (e, ui) { alert('pressed'); $(this).remove(); }, buttons: { "Save": function () { alert('Dialog SAVE pressed but for has not yet been subbmitted'); var commentForm = '#commentForm'; var iFrameDOM = $("iframe#myiframe2").contents(); // NOT WORKING iFrameDOM.contents().find('form').submit(); }, "Close": function () { $(this).dialog("close"); } } }); dialog1.dialog('open'); }); }); </script> </head> <body> <!-- Form Page must reside in same domain --> <br /><br /><a id="pop" href="http://localhost/test/formtest" title="Hello World!!!">click me for the Form</a> </body> </html>
Form Page<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"> </script> <script> $(document).ready(function(){ $('#commentForm').submit(function(e){ e.preventDefault(); alert("yayyy for summitted"); console.log("submitted"); }); //$("form").submit(function(){ // alert("form is submitted."); //}); }); </script> </head> <body> <h2>A very Simple Forrm</h2> <p>On Submit we use jQuery submit() Method and pop up an alert</p> <form id="commentForm" name='commentForm' method="get" action="/"> Your Name: <input type="text" name="name" value="Santa Clause"><br> Your Age: <input type="text" name="age" value="35"><br><br> <input type="submit" name="submit" id="mybutton" value="Submit"> </form> </body> </html>
Return Codes coming from a Database. What to check for?
in Beginners Web Design
Posted
I always get confused on this part.
I am playing with a mySql Maria DB. in my localhost PC.... ohhh am using PDO
Am I just checking for "0" failure and "1" Success return?
some extra code to see how many rows effected ..
in DB2 a return code of 100, meant no records were found but it was a successful execution.
What kinda things do i need to check for? do the all return a code?
What is the DB goes down? will my query return a code? or will it fail in another place?
Besides a down DB what else must i look for?
Thanks