Jump to content

A JM

Members
  • Posts

    249
  • Joined

  • Last visited

Everything posted by A JM

  1. Thanks, I think the AJAX implementation makes the most sense at the moment - just not sure what the XML object or even if the XML object is returned to be parsed for populating the text boxes... Seems like a basic form implementation to some extent and should be being widely used on the web... maybe others are doing this fully in javascript and not using PHP? Since the project is fully php I've got to come up with some solution to this small problem.. just hoping some someone can shed some additional light on the DIV tag pars of the object returned. AJM,
  2. I ran across a piece of code that I believe I understand and can implement but I'm not certain as to how to modify it to return individual fields as oppposed to a recordset? At least that's what it appears the reult is.. The query echo's a resultset $packing = $row['packing'];, since I want to fill multiple text boxes I assume they each need a <div> tag but how do I split the resultset to populate my boxes?
  3. Thanks for the code daviddannis. method_checks.php, is server side.. correct? So, is Ajax/Javascipt the best and fastest way to accomplish this?
  4. I'm looking for some examples or suggestions on the best practices for filling an HTML form based upon a users selection of a dropdown box. I'm seeing a lot of Ajax suggestions but not finding any really good examples as I've not used ajax before it would be great to see some code specific examples. So, essentially a Customer dropdown is fully populated from MySQL when the php page loads and I want the user information (address, city, state, zip, etc.) to be filled in on the form from a MySQL based query using the users selection in the dropdown, seems kind of trivial but I'm finding not so much. I'm pretty sure this is going to involve an onChange() event and some javascript.. just need to be able to put the pieces together. Any ideas and suggestions are welcome. Thanks. AJM,
  5. So, I finally got it working.. thanks to your help. Helping me with what I was doing wrong was enough to get me over the hump.. var iframe = document.getElementsByTagName('iframe')[0]; var tbl = iframe.contentWindow.document.getElementById("theTable"); var tbdy = tbl.getElementsByTagName('tbody')[0].getElementsByTagName('tr').length; AJM,
  6. Still not having any luck. I'm able to get the iFrame name but not any of the objects on the iFrame, specifically the table and count of <tr>? I get the iFrame name here: var frame = document.getElementById("jupload"); var frm = frame.contentDocument.getElementById("fileupload"); alert(frm.name); But I can't get the Table ID here?? var frame = document.getElementById("jupload"); var frm = frame.contentDocument.getElementById("fileupload"); var tbl = frm.contentDocument.getElementsById('theTable'); alert(tbl.id); Its erroring on the line: var tbl = frm.contentDocument.getElementsById('theTable'); Because if I replace alert(tbl.id); with alert("test"); I get no alert... var frame = document.getElementById("jupload"); var frm = frame.contentDocument.getElementById("fileupload"); var tbl = frm.contentDocument.getElementsById('theTable'); alert("test");
  7. Using the following, I'm able to retrieve the frame.name property and frm.name property but I am unable to get the tbl.id?? So, I'm missing something obvious.. maybe how the object is being referenced?? var frame = document.getElementById("jupload"); var frm = frame.contentDocument.getElementById("fileupload"); var tbl = frm.getElementsById("theTable"); alert(tbl.id); I think that since I'm able to get the table and form on the iFRams that also answers the question about the Origin. Thanks for the help.
  8. Could you be a little more specific as to what you mean by the same domain? the parent url: http://mydomain.com/dbpages/index.html the iFrame url:http://mydomain.com/jquery/iframe.html So what should that cocde look like if both of those cases are true?
  9. I'm also trying another variation without much luck.. var frame = document.getElementById("jupload"); var tbl = frame.contentDocument.forms[0].getElementById("table"); var rows = tbl.tbodies[0].getElementsByTagName('tr').length; alert(rows);
  10. Can someone help with the syntax on getting the number of rows in an iframe tbody? I think this is giving me the table rows not the tbody rows, not sure though... var frame = document.getElementById("jupload"); var rows = frame.contentDocument.forms[0].getElementsByTagName("table")[0].rows.length; I think it should be closer to this: var frame = document.getElementById("jupload"); var rows = frame.contentDocument.forms[0].getElementsByTagName('table')[0].getElementsByTagName("tr").length;
  11. This code is running on the iFrame itself.. should it be implemented differently? I'm a little confused on the iFrame implementation of "document" seems to me if its running on the iFrame it would be the "document" or that specific to the parent? AJM,
  12. I'd like to set the value of a hidden object on an iFrame and I'm having a problem... what should be working isn't anyone have any ideas? I set a default value initially but then need to update that value if a file is iedntified, if se then it should update the hidden field on the iFrame. Thatnks for looking. AJM, <!-- The template to display files available for download --> <script id="template-download" type="text/x-tmpl"> <input type="input" id="filename" name="filename" value="Q"> <!-- set default hidden variable to represent no file selected--> {% for (var i=0, file; file=o.files[i]; i++) { %} {% if (file.url.split("/")[7] == '<?php echo session_id()?>') { %} <!-- Skip over files not associated with the session_id() --> {% document.getElementById("filename").value="test"; %} <!-- set hidden variable to file name if it exists --> <tr class="template-download fade"> <td> <span class="preview"> {% if (file.thumbnailUrl) { %} <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a> {% } %} </span> </td> <td> <p class="name"> <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a> </p> {% if (file.error) { %} <div><span class="error">Error</span> {%=file.error%}</div> {% } %} </td> <td> <span class="size">{%=o.formatFileSize(file.size)%}</span> </td> <td> <button class="delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>Delete</button> <input type="checkbox" name="delete" value="1" class="toggle"> </td> </tr> {% } %} {% } %} </script>
  13. So the selection of the files is done in an iFrame would you still approach it with Javascript? Thanks,
  14. I'm trying to prevent a user from posting unless they attach a file and seem to be mentally blocked at the moment and struggling to figure this out. I could use some help or suggestions on how to accomplish this... all and any would be appreciated... $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } //******************************************************************************************************************************************* //******************************************************************************************************************************************* if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { //Get user ID from users selection of user_company mysql_select_db($database_makerdbconn, $makerdbconn); $query_rstopenusers = "SELECT userid FROM users WHERE name = '" . $_POST['maker_company'] . "'"; $rstopenusers = mysql_query($query_rstopenusers, $makerdbconn) or die(mysql_error()); $row_rstopenusers = mysql_fetch_assoc($rstopenusers); $user_ID = $row_rstopenusers['userid']; $insertSQL = sprintf("INSERT INTO invoicecue (maker_name, maker_company, maker_street1, maker_street2, maker_city, maker_state, maker_zipa, maker_phone, maker_email, maker_invoicenum, invoice_doc_folder, ins_name, ins_street1, ins_street2, ins_city, data_id, chk_new, user_id, new_timestamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, now())", GetSQLValueString($_POST['maker_name'], "text"), GetSQLValueString($_POST['maker_company'], "text"), GetSQLValueString($_POST['maker_street1'], "text"), GetSQLValueString($_POST['maker_street2'], "text"), GetSQLValueString($_POST['maker_city'], "text"), GetSQLValueString($_POST['maker_state'], "text"), GetSQLValueString($_POST['maker_zipa'], "text"), GetSQLValueString($_POST['maker_phone'], "text"), GetSQLValueString($_POST['maker_email'], "text"), GetSQLValueString($_POST['maker_invoicenum'], "text"), GetSQLValueString(sprintf("%07d",$row_LastinvoiceNum + 1), "text"), GetSQLValueString($_POST['data_id'], "int"), GetSQLValueString($_POST['chk_new'], "int"), GetSQLValueString($user_ID, "int")); mysql_select_db($database_makerdbconn, $makerdbconn); $Result1 = mysql_query($insertSQL, $makerdbconn) or die(mysql_error()); //last invoice number entered pulled from mySQL $_SESSION['last_invoice'] = sprintf("%07d", mysql_insert_id()); $insertGoTo = "invoiceconfirm.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?> <?php //************************************************File Save Routine************************************************************************** //******************************************************************************************************************************************* if(isset($_POST['submit'])){ //form was submitted for saving $uploaddir = "../invoices/"; // Upload directory: remember to give it write permission! $uploadfolder = sprintf("%07d",$row_LastinvoiceNum + 1); //last invoice entered from mySQL used as file name //check for a single file if (count(scandir("../jqueryupload/server/php/files/".session_id())) > 2) { //Tests for an array of files, first 2 items of array ("." , "..") s/b ignored if ($_POST['submit']) { //check for new invoice folder in ../invoices/ if (!is_dir($uploaddir . $uploadfolder)) { //does the invoice# folder exist, if not create it mkdir($uploaddir . $uploadfolder); } // Identify source and destination directories $source = "../jqueryupload/server/php/files/".session_id()."/"; $destination = $uploaddir . $uploadfolder."/"; //Create array of files $files = scandir($source); // Cycle through all source files foreach ($files as $file) { if (in_array($file, array(".",".."))) continue; // If we copied this successfully, mark it for deletion if (copy($source.$file, $destination.$file)) { //file(s) successfully copied } else { echo "Error while uploading the file, Please contact the webmaster."; } } } else { // upload button was not pressed header("Location: invoiceroot.php"); } } else { // user did not select a file to upload echo "Please select a file to upload."; } } ?> Thanks. AJM,
  15. Of course just after I post to the forum I found the solution... I wasn't using the correct case on the "GET".. changed the case and it works. Sorry for the noise. AJM,
  16. Been a while since I've posted to the forum.. I've got a problem trying to get a variable that has been passed to an iframe. The variable appears in the iframe HTML tags but I'm unable to retrieve it on the page that it being passed to, any ideas on what I'm doing wrong? Here is the source from of the parent page, a simple iframe: <iframe src="/jqueryupload/upload.php?FileSaveNum=0001336" width=99% height="150"></iframe> and I've been trying to use $_GET['FileSaveNum']; with no luck on the iframe page. Here is the source on the iframe page: <?php //******The number variable******* $FileNum = $_Get['FileSaveNum']; echo $FileNum; ?> One thing to keep in mind is that there is no 'SUBMIT' happening here to the iframe, so maybe that's where my problem is? Hopefully someone can help with how I can read the variable from the AJM,
  17. Thanks for the info. I'll work on changing it.
  18. I appreciate the response premiso. Sorry, I forgot to comment out the exit; which I have been doing when running in production. How else would I do this, echo? Thanks,
  19. I'm successfully able to export a file but am having a problem with a redirect after the files is downloaded, can this be done? am I just trying to implement it incorrectly? ... //Print the iif file header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"invoice.txt"); header("Pragma: no-cache"); header("Expires: 0"); print $data; exit; //after exporting return to main page $insertGoTo = "home.php?"; header(sprintf("Location: %s", $insertGoTo)); Any help would be appreciated. Thanks,
  20. Not sure I follow... You mean this would work? If $invamt != 0 then continue;
  21. How do I skip to the next item in the array if $invamt is = 0? while($row = mysql_fetch_assoc($result)) { $invamt = round(($row['inv_amount'] //I'm looking for something like: If $invamt = 0 then goto next array item.... .... The rest of my code goes here .... } Thanks for any help. A JM,
  22. ah, makes sense I missed the adding strings together part, duh.. thanks.
  23. Many thanks. Out of curiosity why didn't my formula work it appears to be adding both strtotime() functions together?? A JM,
  24. I'm trying to add 30 days to a date and not having any success - the formula looks correct but the results are incorrect. Can someone help? $duedate = date("m/d/Y", strtotime($row['inv_submitted'])); $duedate = $duedate + date("m/d/Y", strtotime("+30 day")); A JM,
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.