Raige All American 4386 Posts user info edit post |
Hey guys, I know a couple ways of doing this but they aren't pretty. Was thinking there might be an easier method than I've thought of.
Basically I created a pager system that submits to a pager company's tool on their site with the number and message associated with it. I'd like to create a log of what pages are made through this tool and I'm not sure how to accomplish this easily.
The purpose of this is so they can track what pages are being made through the system and not have to look at 125 seperate pager records.
Ideas?
[Edited on December 14, 2006 at 3:47 PM. Reason : Clarrification] 12/14/2006 3:46:18 PM |
Bakunin Suspended 8558 Posts user info edit post |
uh
yeah
open a file
write to it
the end 12/14/2006 5:54:58 PM |
Raige All American 4386 Posts user info edit post |
It has to happen when someone hits submit on the form. So either I can send it to one page and have it redirect or do some javascript magic. Opening a file and writing to it kinda defeats the purpose of making a database log.
However I guess i didn't specific where the log would be. 12/14/2006 7:38:31 PM |
scrager All American 9481 Posts user info edit post |
form to enter data submits to local page local page logs data and submits to pager site 12/14/2006 11:11:50 PM |
Raige All American 4386 Posts user info edit post |
^ yup. I guess what I was hoping was there was something I could to the form that would allow it to submit to two places at the same time. No biggie. 12/15/2006 7:25:12 AM |
Wolfmarsh What? 5975 Posts user info edit post |
You can trap the submit with javascript and do all your logging operations then allow it to submit like normal.
For example:
In your header:
<SCRIPT language="javascript"> function saveClick() { //all your logging shit
//then tell the form to submit Form1.submit(); } </SCRIPT>
Your form button:
<input type="submit" name="btnSave" value="Save" id="btnSave" onClick="saveClick()">
Obviously this is psuedo code, but I have this running in several sites.
[Edited on December 15, 2006 at 8:07 AM. Reason : .] 12/15/2006 8:03:05 AM |
Noen All American 31346 Posts user info edit post |
Quote : | "form to enter data submits to local page local page logs data and submits to pager site
" |
Dunno what you are smoking Raige, but this is the correct and by far the most simple solution12/15/2006 10:09:51 AM |
Bakunin Suspended 8558 Posts user info edit post |
you know, instead of making threads like this
why don't you look at the HTML, JavaScript, and DOM specs and figure out what the fuck you're doing 12/18/2006 1:37:48 PM |
DonMega Save TWW 4201 Posts user info edit post |
Quote : | "Dunno what you are smoking Raige, but this is the correct and by far the most simple solution" |
I think you could do it simpler
Just use the Prototype library and submit the form twice. Modifying what Wolfmarsh did:
<SCRIPT language="javascript"> function saveClick() { //all your logging shit
//then tell the form to submit Ajax.Request(url1, {method:'post', parameters: Form.serialize(formid)}); Ajax.Request(url2, {method:'post', parameters: Form.serialize(formid)});
return false; } </SCRIPT>
Your form button:
<input type="submit" name="btnSave" value="Save" id="btnSave" onClick="return saveClick()">12/18/2006 1:50:04 PM |
qntmfred retired 40726 Posts user info edit post |
ya know, that stuff would work, and i've done it a few times myself, but i get real uneasy anytime i have javascript doing any heavy lifting. do it all on the php/asp/whatever side, at least you will know that the php will do what you want, and not have to worry about some browser's wack javascript implementation screwing your stuff up
[Edited on December 18, 2006 at 2:06 PM. Reason : scrager and noen are correct, as usual] 12/18/2006 1:57:42 PM |
Stein All American 19842 Posts user info edit post |
Quote : | "I think you could do it simpler
Just use the Prototype library and submit the form twice. " |
There's absolutely nothing simpler about that.12/18/2006 2:53:41 PM |
DonMega Save TWW 4201 Posts user info edit post |
Quote : | "not have to worry about some browser's wack javascript implementation screwing your stuff up" |
that's the benefit of using prototype, it's designed to take care of the cross-browser support12/18/2006 3:19:00 PM |
BigMan157 no u 103354 Posts user info edit post |
i'm with qntmfred and scrager on this though i don't really know shit about the Prototye library 12/18/2006 3:37:32 PM |
Raige All American 4386 Posts user info edit post |
Thanks for the ideas. I knew how to do it with javascript, but I really don't have any php experience so I'm not sure how to code that.
I didn't realize Ajax could be used like that though. Good call.
[Edited on December 18, 2006 at 4:54 PM. Reason : verbs are good!] 12/18/2006 4:53:30 PM |
qntmfred retired 40726 Posts user info edit post |
well what language are you using? you're not crafting the whole site with javascript, right 12/18/2006 5:01:55 PM |
Pyro Suspended 4836 Posts user info edit post |
Avoid javascript like the plague for something like this.
[Edited on December 18, 2006 at 5:41 PM. Reason : Do it all server side.] 12/18/2006 5:40:42 PM |
Raige All American 4386 Posts user info edit post |
no no. It's an html page, that's hosted on an apache box with php support. I'm probably just going to move the entire app over to a Cold Fusion box and do it there. No, I have no plans of doing this all in javascript.
I thought I'd throw myself at the wolves for a better idea before i did it in CF. 12/18/2006 7:54:05 PM |