Old 08-30-2014, 07:02 AM   #1
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default PHP

I need the help of the wizards again.

Question: I have a button on a website the executes a php script I wrote that writes a file on the server (a file that I will afterward auto download to the user). The script works fine, I can write the file, but the problem I can't get around is how to get that done without opening a new browser window? Just run the php script on the server and let it do what it does.

So basically (and thanks in advance) I want to click a button and ...

1. Execute some Javascript to load a text box with the text I'll write back to the server.

2. After that, use the form button where the text area is to write the text in the text area to a file on the server.

I can do both but #2 always opens a new browser window which I don't want.

Help?
Lawrence is offline   Reply With Quote
Old 08-30-2014, 07:08 AM   #2
karbomusic
Human being with feelings
 
karbomusic's Avatar
 
Join Date: May 2009
Posts: 29,269
Default

I don't understand why submitting a form is even opening a new window but you could just do the equivalent of an ajax request via javascript which posts the data behind the scenes bypassing a page load altogether:

http://www.w3schools.com/xml/xml_http.asp

Probably lots of ways to do it.
__________________
Music is what feelings sound like.
karbomusic is online now   Reply With Quote
Old 08-30-2014, 08:09 AM   #3
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Holy crap. That might be easier.

I'll investigate. Thanks.
Lawrence is offline   Reply With Quote
Old 08-30-2014, 09:00 AM   #4
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Update: Yes, I think this will be much better than php. I found a page that has a demo download link that does exactly what I want ... http://www.xul.fr/en-xml-ajax.html

... so I'm pulling out the sources from the demo zip link near the bottom of that page.

K, you're like Dudley DoRight, always appearing to save the day. Big thanks.

====== Off Topic UI Stuff =============================

Note: I'm building a web page with Coffee Cup VSD, great app, but below is yet another example of how what should be really obvious stuff gets lost in the "forest for the trees".

What you see below is the HTML editor in this app, the window where you'd manually type in HTML or JS or whatever else, and then place that object anywhere you want on the page. The concept actually works really great for design / layout purposes. Where it fails miserably is in it's own window design. The editor not only uses tiny fonts, but the window doesn't even resize. It's like the developers never actually even considered that someone might want to edit long scripts in it.

Under what circumstances would a developer not make that window sizable, and have larger fonts? Shades of some of Reaper's parts...

Lawrence is offline   Reply With Quote
Old 08-30-2014, 09:15 AM   #5
karbomusic
Human being with feelings
 
karbomusic's Avatar
 
Join Date: May 2009
Posts: 29,269
Default

Quote:
Originally Posted by Lawrence View Post
Under what circumstances would a developer not make that window sizable, and have larger fonts? Shades of some of Reaper's parts...

Probably so they don't have to deal with all the resizing and positioning of the text box, buttons, icons that comes with it is my immediate guess. It's that thing that saves times and get's refined (sometimes) later.
__________________
Music is what feelings sound like.
karbomusic is online now   Reply With Quote
Old 08-30-2014, 09:30 AM   #6
Lawrence
Human being with feelings
 
Join Date: Mar 2007
Posts: 21,551
Default

Quote:
Originally Posted by karbomusic View Post
Probably so they don't have to deal with all the resizing and positioning of the text box, buttons, icons that comes with it is my immediate guess. It's that thing that saves times and get's refined (sometimes) later.
I guess. It just makes me go ... "hmmmm....".

I mean, seriously, there's only 4 buttons there so those could easily go up on top of the editor and just make the window resizable. The buttons wouldn't even have to move in that case.

When I see things like this I figure there has to be a valid reason or it just doesn't make any sense. In this case, with hindsight, it actually may be intentional, to maybe sell their higher priced web editor products. I mean, after editing text in that thing for awhile you'd be looking to not do much more of that.

At any rate, I'm getting a good JS refresher. It's been awhile.

Last edited by Lawrence; 08-30-2014 at 09:35 AM.
Lawrence is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.