DeX Posted March 27, 2012 Share Posted March 27, 2012 Short question: How can I get a string of HTML code and replace all the <input> tags with their values? Long question: I have a web page with a purchase order on it in HTML format and one or more of the columns is editable via input boxes. So the user can change the quantity/length of the material before submitting it. Once they choose to save it, it sends the string of HTML to a PDF generator (DOMPDF) which converts the HTML to a PDF file and saves it to the server. The user then has a hard copy of the purchase order PDF saved for each job. The problem is DOMPDF doesn't do well with <input> tags, it just leaves them as a blank space. So I want to take that string of HTML and replace all input boxes with their values before sending it to DOMPDF. Currently I'm using Javascript to do just that when the user clicks to save the modified purchase order. The problem with this is it only works for when the user modifies the purchase order and saves a new modified copy. I need to save a base unmodified copy of it when the page loads so this would strip all the input boxes from the page as soon as it loads and the user would no longer be able to edit anything. So I need something to send the string to DOMPDF when the page loads but not modify what's on the page. Any ideas? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/259841-how-can-i-replace-boxes-with-their-values/ Share on other sites More sharing options...
The Letter E Posted March 28, 2012 Share Posted March 28, 2012 How would you know what value to the <input> held if the page has just loaded? Are you perhaps trying to accomplish this on a subsequent load of the page, after a user has submitted some data? Quote Link to comment https://forums.phpfreaks.com/topic/259841-how-can-i-replace-boxes-with-their-values/#findComment-1331796 Share on other sites More sharing options...
DeX Posted March 28, 2012 Author Share Posted March 28, 2012 No, the input boxes are loaded with default values. I want to send it all to DOMPDF to create the base PDF file without any changes to it. I also want to give the user the ability to edit any of those fields and save it again. Quote Link to comment https://forums.phpfreaks.com/topic/259841-how-can-i-replace-boxes-with-their-values/#findComment-1331898 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.