Re: [PHP] Saving css state in javascript and passing to php via form submit
On 4/16/07, Tim <[EMAIL PROTECTED]> wrote: ... > You could use AJAX to get things from/to PHP, but why should > you? You can use session within javascript too i believe. > > > > > Tijnema > > > > > > ps. Maybe you could also use AJAX instead of submitting forms the > > > whole time. ... > Really, it's not that hard to use AJAX. You might want to > look at www.tizag.com, there it is really easy explained. > It's nothing more then making new request to scripts inside > javascript. > Was a great idea and also works great until the moment i needed to upload images :P You have a suggestion for that by any chance Tijnema? Regards, Tim I would use an iframe for this.Didn't test following code, but shoudl work though. and now just make sure that your upload.php script doesn't return anything, or it will be displayed inside the iframe :) If you want to know when upload is done, you should check that through AJAX. you could give the upload an unique number, and store the results of the upload in a database for example, then request that id once in 10 seconds lets say, and when it's done it will return something useful :) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Saving css state in javascript and passing to php via form submit
... > You could use AJAX to get things from/to PHP, but why should > you? You can use session within javascript too i believe. > > > > > Tijnema > > > > > > ps. Maybe you could also use AJAX instead of submitting forms the > > > whole time. ... > Really, it's not that hard to use AJAX. You might want to > look at www.tizag.com, there it is really easy explained. > It's nothing more then making new request to scripts inside > javascript. > Was a great idea and also works great until the moment i needed to upload images :P You have a suggestion for that by any chance Tijnema? Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Saving css state in javascript and passing to php via form submit
The weather in here gets stormy easily i see :D Anyways thanks Richard, that's the kind of idea i was orginally looking for, before opting for the ajax way, which is only going to optimize my application more and give me more flexibility in doing what i need. Have looked up javascript and DOM and now understand how to "dynamically" create content from javascript that can later be interpreted by a php form. In any case everyones input was great, got a lot of ideas out of it. Thanks all ;) P.S. Sorry for the delicately on/off topic, was inbetween languages here, and since i'm more familiar with your input i oppted for this list ;) Tim > -Message d'origine- > De : Richard Lynch [mailto:[EMAIL PROTECTED] > Envoyé : dimanche 1 avril 2007 07:39 > À : Tim > Cc : php-general@lists.php.net > Objet : Re: [PHP] Saving css state in javascript and passing > to php via form submit > > On Fri, March 30, 2007 9:45 am, Tim wrote: > > My issue is on page reload, i have a form on the same page, when a > > category is clicked, the categorie info displays and you can update > > the info through this form (table and form on same page). My issue > > comes when i post the data, the page comes back and my > category tree > > folds up which is normal because all divs are set to > "display:none;". > > Just fought through something like this today... > > > > function save_styles(){ > var div; > var styles_saver=document.getElementById('styles_saver'); > foreach(divs as d){ > div = divs[d]; > styles_saver.innerHTML += '<input type="hidden" name="style["' + d > + ']" value="' + div.style '" />'; > } > styles_saver.submit(); > > > This is all JS, obviously... > > > What are the technologies IF there are any and what should > i look up > > to find docs that cover this type of datatransfer ie: > javascript->php. > > So now in the PHP part, to force this at least nominally > on-topic, you have a nice array in $_POST['styles'] with an > index by div in order, that you'd process like any $_POST > value which is an array: > > if (isset($_POST['styles']) && is_array($_POST['styles'])){ > foreach($_POST['styles'] as $d => $style){ > //do something with div's $style, indexed by $d > } > } > > You could presumably get each div's id with div.id or > somesuch, and use that instead of 'd' above. > > -- > Some people have a "gift" link here. > Know what I want? > I want you to buy a CD from some indie artist. > http://cdbaby.com/browse/from/lynch > Yeah, I get a buck. So? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
Richard Lynch wrote: > > On Fri, March 30, 2007 12:13 pm, Juergen Wind wrote: >> Tijnema ! wrote: >>> >>> You can use session within javascript too i believe. >>> >> no, sessions are completely serverside, but you can use js to pass >> variables >> using the query string when sending a xmlHttpRequest. > > [pedantic] > Actually, the cookie for a session, if it's using cookies and not > trans_sid, lives on the client, and can (I think) be affected in JS. > > One can even store up to 4K of session data *in* the cookie, > sufficiently encrypted with a 2-way encryption with the private key > server-side, and achieve server-neutrality in a server farm, if one is > so inclined. > > So it's POSSIBLE for one to architect a system wherein the session all > lives on the client. > > If you're willing to expose your entire inner workings of your > application (e.g., it's Open Source anyway, or there's just nothing > worth hiding in the first place) you wouldn't NEED to encrypt the > data. > > None of this would be useful in the context of this particular thread. > [/pedantic] > > of course you are right, Richard, i was too lazy to elaborate the whole issue, i should have written "$_SESSION" ;) -- View this message in context: http://www.nabble.com/Saving-css-state-in-javascript-and-passing-to-php-via-form-submit-tf3492648.html#a9776277 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On Fri, March 30, 2007 12:13 pm, Juergen Wind wrote: > Tijnema ! wrote: >> >> You can use session within javascript too i believe. >> > no, sessions are completely serverside, but you can use js to pass > variables > using the query string when sending a xmlHttpRequest. [pedantic] Actually, the cookie for a session, if it's using cookies and not trans_sid, lives on the client, and can (I think) be affected in JS. One can even store up to 4K of session data *in* the cookie, sufficiently encrypted with a 2-way encryption with the private key server-side, and achieve server-neutrality in a server farm, if one is so inclined. So it's POSSIBLE for one to architect a system wherein the session all lives on the client. If you're willing to expose your entire inner workings of your application (e.g., it's Open Source anyway, or there's just nothing worth hiding in the first place) you wouldn't NEED to encrypt the data. None of this would be useful in the context of this particular thread. [/pedantic] -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On Sat, March 31, 2007 4:11 am, Tijnema ! wrote: > I've did a few test on this PC(AMD64 3200+), it's running EasyPHP > (Apache+PHP+MySQL), and it shows me that PHP is about twice as fast > then Javascript.(Tested using IE6, FF wasn't working because script > took too long to execute, which generates messages on firefox, and > which didn't let me finish the script) On a LARGE and BUSY server, the question probably isn't "which is faster". It's "which are there more of"? :-) In other words, if you have 100 $40,000 Sun servers, and you have two options: Throw some PHP on them all, to process this stuff in 0.03 seconds Throw some JS out, and let the client side process it in 0.06 seconds Note that you probably have zillions of visitors with over-powered desktop machines, for the most part. Which is going to make your overloaded servers "seem" faster? Not that I've ever done this, mind you, but I suspect that it's another case where a raw benchmark isn't really applicable in the Real World, for most cases where you'd even want to benchmark it. YMMV NAIAA IANAL -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On Fri, March 30, 2007 9:45 am, Tim wrote: > My issue is on page reload, i have a form on the same page, when a > category > is clicked, the categorie info displays and you can update the info > through > this form (table and form on same page). My issue comes when i post > the > data, the page comes back and my category tree folds up which is > normal > because all divs are set to "display:none;". Just fought through something like this today... function save_styles(){ var div; var styles_saver=document.getElementById('styles_saver'); foreach(divs as d){ div = divs[d]; styles_saver.innerHTML += ''; } styles_saver.submit(); This is all JS, obviously... > What are the technologies IF there are any and what should i look up > to find > docs that cover this type of datatransfer ie: javascript->php. So now in the PHP part, to force this at least nominally on-topic, you have a nice array in $_POST['styles'] with an index by div in order, that you'd process like any $_POST value which is an array: if (isset($_POST['styles']) && is_array($_POST['styles'])){ foreach($_POST['styles'] as $d => $style){ //do something with div's $style, indexed by $d } } You could presumably get each div's id with div.id or somesuch, and use that instead of 'd' above. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
Tijnema ! wrote: > On 3/31/07, Jochem Maas <[EMAIL PROTECTED]> wrote: >> Tijnema ! wrote: .. >> >> 'processing' JSON formatted data is a matter of running a single eval() >> line in javascript!?! >> >> just outputting HTML directly into a div is useful in many simple >> situations but it doesn't leave a whole lot of room for any real client >> sided application logic ... > > All that "client side application logic" can also be done in PHP. > Where's the sense in learning to work with JSON, if it can be done in > PHP too? PHP is a lot faster then javascript right? ok please shut up - you've completely missed the point. > > Tijnema >> >> > >> > Tijnema >> >> >> >> > >> >> > Regards, >> >> > >> >> > Tim >> >> > >> >> >> >> >> > >> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On 3/31/07, Tijnema ! <[EMAIL PROTECTED]> wrote: On 3/31/07, Jochem Maas <[EMAIL PROTECTED]> wrote: > Tijnema ! wrote: > > On 3/30/07, Jochem Maas <[EMAIL PROTECTED]> wrote: > >> Tim wrote: > >> > > > > > > > > ... > > >> personally I prefer JSON formatted data, for which there are even a > >> couple of > >> functions available in newer versions of php (otherwise you can find > >> code on the net > >> easily enough to handle JSON data creation/parsing): > >> > >> http://php.net/json > > > > I prefer not to do a lot of processing in Javascript, what i usually > > do is send plain HTML and directly output it inside a > > 'processing' JSON formatted data is a matter of running a single eval() > line in javascript!?! > > just outputting HTML directly into a div is useful in many simple > situations but it doesn't leave a whole lot of room for any real client > sided application logic ... All that "client side application logic" can also be done in PHP. Where's the sense in learning to work with JSON, if it can be done in PHP too? PHP is a lot faster then javascript right? Tijnema I've did a few test on this PC(AMD64 3200+), it's running EasyPHP (Apache+PHP+MySQL), and it shows me that PHP is about twice as fast then Javascript.(Tested using IE6, FF wasn't working because script took too long to execute, which generates messages on firefox, and which didn't let me finish the script) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On 3/31/07, Jochem Maas <[EMAIL PROTECTED]> wrote: Tijnema ! wrote: > On 3/30/07, Jochem Maas <[EMAIL PROTECTED]> wrote: >> Tim wrote: >> > > > > > > ... >> personally I prefer JSON formatted data, for which there are even a >> couple of >> functions available in newer versions of php (otherwise you can find >> code on the net >> easily enough to handle JSON data creation/parsing): >> >> http://php.net/json > > I prefer not to do a lot of processing in Javascript, what i usually > do is send plain HTML and directly output it inside a 'processing' JSON formatted data is a matter of running a single eval() line in javascript!?! just outputting HTML directly into a div is useful in many simple situations but it doesn't leave a whole lot of room for any real client sided application logic ... All that "client side application logic" can also be done in PHP. Where's the sense in learning to work with JSON, if it can be done in PHP too? PHP is a lot faster then javascript right? Tijnema > > Tijnema >> >> > >> > Regards, >> > >> > Tim >> > >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
Tijnema ! wrote: > On 3/30/07, Jochem Maas <[EMAIL PROTECTED]> wrote: >> Tim wrote: >> > > > > > > ... >> personally I prefer JSON formatted data, for which there are even a >> couple of >> functions available in newer versions of php (otherwise you can find >> code on the net >> easily enough to handle JSON data creation/parsing): >> >> http://php.net/json > > I prefer not to do a lot of processing in Javascript, what i usually > do is send plain HTML and directly output it inside a 'processing' JSON formatted data is a matter of running a single eval() line in javascript!?! just outputting HTML directly into a div is useful in many simple situations but it doesn't leave a whole lot of room for any real client sided application logic ... > > Tijnema >> >> > >> > Regards, >> > >> > Tim >> > >> >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On 3/30/07, Jochem Maas <[EMAIL PROTECTED]> wrote: Tim wrote: > > > > > > >> I think you want to use sessions for this :) > Ok, i can put the data in the session variable, but i can only get the > "current" state through javascript > > ie:onsubmit="getstate()"; which would get the id's of the blocks that > are set to display:block; > > But in getstate() how do i pass that to php to set that session variable? You could use AJAX to get things from/to PHP, but why should you? You can use session within javascript too i believe. >>> Hmm javascript setting server-side session data?? >>> Sounds weird, but i'll look into it.. >> server-side session data? i never heard of server-side sessions... >> AFAIK they are send in the HTTP headers from and to the server. >> Cookies are nearly the same as sessions, i found this article (with >> examples) that goes about parsing cookies from javascript. So >> you could also do it with cookies. >> http://www.javascriptkit.com/javatutors/cookie2.shtml > Ermmm... > Isn't $_SESSION a superglobal available only during script execution? > Yes it sets a session_id in a cookie to which is sent to the server to > identifie the client, but to my knowledge $_SESSION['my_var'] = 'some_data'; > is stored server side and set only through a server side script... > > Now storing data in cookies is client-side, that i agree.. > Am i confused or are you confusing me? :P > >> Tijnema >> >> ps. Maybe you could also use AJAX instead of submitting forms >> the whole time. > In the next version of my framework i would like to, i still > havent quite understood the whole concept, not enough research yet, but yes > i'll be doing that next ;) (you know deadlines, can't sit and read docs all day etc.. > Although i'd rather!) > > ;) > > Regards, > > Tim Really, it's not that hard to use AJAX. You might want to look at www.tizag.com, there it is really easy explained. It's nothing more then making new request to scripts inside javascript. >>> Nice tutorial thanks for that, i'll look it up, maybe >> intergrate it >>> right away, would really make my day if i could :)) >>> >>> Regards, >>> >>> Tim >> It's not too hard, but if you already did a lot of work on >> the form processing, you prefer not to write it all over >> again i think ;) > > Wrote a class to do the form validation, so i could always make a .php that > runs the form data through the validator and sends back the response.. In > xml i think it has to be? the response doesn't have to be in any particular form ... ofcourse the X in AJAX refers to XML but it's not obligatory in the end your just spitting out a big long string and your clientside code can do with it whatever it wants. personally I prefer JSON formatted data, for which there are even a couple of functions available in newer versions of php (otherwise you can find code on the net easily enough to handle JSON data creation/parsing): http://php.net/json I prefer not to do a lot of processing in Javascript, what i usually do is send plain HTML and directly output it inside a Tijnema > > Regards, > > Tim > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
Tim wrote: > > > > > > >> I think you want to use sessions for this :) > Ok, i can put the data in the session variable, but i can only get the > "current" state through javascript > > ie:onsubmit="getstate()"; which would get the id's of the blocks that > are set to display:block; > > But in getstate() how do i pass that to php to set that session variable? You could use AJAX to get things from/to PHP, but why should you? You can use session within javascript too i believe. >>> Hmm javascript setting server-side session data?? >>> Sounds weird, but i'll look into it.. >> server-side session data? i never heard of server-side sessions... >> AFAIK they are send in the HTTP headers from and to the server. >> Cookies are nearly the same as sessions, i found this article (with >> examples) that goes about parsing cookies from javascript. So >> you could also do it with cookies. >> http://www.javascriptkit.com/javatutors/cookie2.shtml > Ermmm... > Isn't $_SESSION a superglobal available only during script execution? > Yes it sets a session_id in a cookie to which is sent to the server to > identifie the client, but to my knowledge $_SESSION['my_var'] = 'some_data'; > is stored server side and set only through a server side script... > > Now storing data in cookies is client-side, that i agree.. > Am i confused or are you confusing me? :P > >> Tijnema >> >> ps. Maybe you could also use AJAX instead of submitting forms >> the whole time. > In the next version of my framework i would like to, i still > havent quite understood the whole concept, not enough research yet, but yes > i'll be doing that next ;) (you know deadlines, can't sit and read docs all day etc.. > Although i'd rather!) > > ;) > > Regards, > > Tim Really, it's not that hard to use AJAX. You might want to look at www.tizag.com, there it is really easy explained. It's nothing more then making new request to scripts inside javascript. >>> Nice tutorial thanks for that, i'll look it up, maybe >> intergrate it >>> right away, would really make my day if i could :)) >>> >>> Regards, >>> >>> Tim >> It's not too hard, but if you already did a lot of work on >> the form processing, you prefer not to write it all over >> again i think ;) > > Wrote a class to do the form validation, so i could always make a .php that > runs the form data through the validator and sends back the response.. In > xml i think it has to be? the response doesn't have to be in any particular form ... ofcourse the X in AJAX refers to XML but it's not obligatory in the end your just spitting out a big long string and your clientside code can do with it whatever it wants. personally I prefer JSON formatted data, for which there are even a couple of functions available in newer versions of php (otherwise you can find code on the net easily enough to handle JSON data creation/parsing): http://php.net/json > > Regards, > > Tim > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
Tijnema ! wrote: > > You can use session within javascript too i believe. > no, sessions are completely serverside, but you can use js to pass variables using the query string when sending a xmlHttpRequest. -- View this message in context: http://www.nabble.com/Saving-css-state-in-javascript-and-passing-to-php-via-form-submit-tf3492648.html#a9757279 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Saving css state in javascript and passing to php via form submit
> It's not too hard, but if you already did a lot of work on > the form processing, you prefer not to write it all over > again i think ;) Actually thanx, that solves my problem if i process my forms/table clicks the ajax way i wont have to reload the page and that takes care of storing the current state :P Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Saving css state in javascript and passing to php via form submit
> > > > > > > > > > I think you want to use sessions for this :) > > > > > > > > Ok, i can put the data in the session variable, but i can > > > only get the > > > > "current" state through javascript > > > > > > > > ie:onsubmit="getstate()"; which would get the id's of the > > > blocks that > > > > are set to display:block; > > > > > > > > But in getstate() how do i pass that to php to set that > > > session variable? > > > > > > You could use AJAX to get things from/to PHP, but why should you? > > > You can use session within javascript too i believe. > > > > Hmm javascript setting server-side session data?? > > Sounds weird, but i'll look into it.. > server-side session data? i never heard of server-side sessions... > AFAIK they are send in the HTTP headers from and to the server. > Cookies are nearly the same as sessions, i found this article (with > examples) that goes about parsing cookies from javascript. So > you could also do it with cookies. > http://www.javascriptkit.com/javatutors/cookie2.shtml Ermmm... Isn't $_SESSION a superglobal available only during script execution? Yes it sets a session_id in a cookie to which is sent to the server to identifie the client, but to my knowledge $_SESSION['my_var'] = 'some_data'; is stored server side and set only through a server side script... Now storing data in cookies is client-side, that i agree.. Am i confused or are you confusing me? :P > > > > > > > > > Tijnema > > > > > > > > > > ps. Maybe you could also use AJAX instead of submitting forms > > > > > the whole time. > > > > > > > > In the next version of my framework i would like to, i still > > > > havent quite understood the whole concept, not enough research > > > yet, but yes > > > > i'll be doing that next ;) (you know deadlines, can't sit > > > and read docs all day etc.. > > > > Although i'd rather!) > > > > > > > > ;) > > > > > > > > Regards, > > > > > > > > Tim > > > > > > Really, it's not that hard to use AJAX. You might want to look at > > > www.tizag.com, there it is really easy explained. > > > It's nothing more then making new request to scripts inside > > > javascript. > > Nice tutorial thanks for that, i'll look it up, maybe > intergrate it > > right away, would really make my day if i could :)) > > > > Regards, > > > > Tim > > It's not too hard, but if you already did a lot of work on > the form processing, you prefer not to write it all over > again i think ;) Wrote a class to do the form validation, so i could always make a .php that runs the form data through the validator and sends back the response.. In xml i think it has to be? Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On 3/30/07, Tim <[EMAIL PROTECTED]> wrote: > -Message d'origine- > De : Tijnema ! [mailto:[EMAIL PROTECTED] > Envoyé : vendredi 30 mars 2007 17:06 > À : Tim > Cc : php-general@lists.php.net > Objet : Re: [PHP] Saving css state in javascript and passing > to php via form submit > > On 3/30/07, Tim <[EMAIL PROTECTED]> wrote: > > > > > > > -Message d'origine- > > > De : Tijnema ! [mailto:[EMAIL PROTECTED] Envoyé : > vendredi 30 mars > > > 2007 16:56 À : Tim Cc : php-general@lists.php.net Objet : > Re: [PHP] > > > Saving css state in javascript and passing to php via form submit > > > > > > On 3/30/07, Tim <[EMAIL PROTECTED]> wrote: > > > > Hello all, > > > > > > > > I have a little dilemna here: > > > > > > > > I am using php/css/mysql to generate a hierarchical table of > > > > categories and sub-categories and sub-sub.. Etc.. > > > > > > > > A screenshot can be found here: > > > > > > > > http://www.internet46.fr/mehim/screenshot.jpg > > > > > > > > Now i'm also using javascript to hide show blocks of divs > > > to hide/show > > > > sub categories.. Typical.. > > > > > > > > My issue is on page reload, i have a form on the same > page, when a > > > > category is clicked, the categorie info displays and you can > > > > update the info through this form (table and form on > same page). > > > > My issue comes when i post the data, the page comes back and my > > > category tree > > > > folds up which is normal because all divs are set to > > > "display:none;". > > > > > > > > I have managed to pass a post/get called lastclicked > that gets the > > > > nodepath of that element and combined with php to generate > > > javascript > > > > that will unfold the tree and highlight the last > clicked element... > > > > > > > > I would like to go one step further and save the entire > > > state of the > > > > tree, say several parent categories are unfolded and i click a > > > > subcategorie to display my form, i want that entire "state" un > > > > unfolded categories to be displayed not just the clicked > > > category, of > > > > course i can get this state and save it in a javascript > > > array, but my > > > > issue is when i post my form how do i pass that state data > > > generated > > > > by javascript back to the page, to be able to unfold the > > > tree in the state it was previously? > > > > > > > > What are the technologies IF there are any and what should > > > i look up > > > > to find docs that cover this type of datatransfer ie: > > > javascript->php. > > > > > > > > Regards, > > > > > > > > Tim > > > > > > I think you want to use sessions for this :) > > > > Ok, i can put the data in the session variable, but i can > only get the > > "current" state through javascript > > > > ie:onsubmit="getstate()"; which would get the id's of the > blocks that > > are set to display:block; > > > > But in getstate() how do i pass that to php to set that > session variable? > > You could use AJAX to get things from/to PHP, but why should > you? You can use session within javascript too i believe. Hmm javascript setting server-side session data?? Sounds weird, but i'll look into it.. server-side session data? i never heard of server-side sessions... AFAIK they are send in the HTTP headers from and to the server. Cookies are nearly the same as sessions, i found this article (with examples) that goes about parsing cookies from javascript. So you could also do it with cookies. http://www.javascriptkit.com/javatutors/cookie2.shtml > > > > > Tijnema > > > > > > ps. Maybe you could also use AJAX instead of submitting forms the > > > whole time. > > > > In the next version of my framework i would like to, i still havent > > quite understood the whole concept, not enough research > yet, but yes > > i'll be doing that next ;) (you know deadlines, can't sit > and read docs all day etc.. > > Although i'd rather!) > > > > ;) > > > > Regards, > > > > Tim > > Really, it's not that hard to use AJAX. You might want to > look at www.tizag.com, there it is really easy explained. > It's nothing more then making new request to scripts inside > javascript. Nice tutorial thanks for that, i'll look it up, maybe intergrate it right away, would really make my day if i could :)) Regards, Tim It's not too hard, but if you already did a lot of work on the form processing, you prefer not to write it all over again i think ;) Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Saving css state in javascript and passing to php via form submit
> -Message d'origine- > De : Tijnema ! [mailto:[EMAIL PROTECTED] > Envoyé : vendredi 30 mars 2007 17:06 > À : Tim > Cc : php-general@lists.php.net > Objet : Re: [PHP] Saving css state in javascript and passing > to php via form submit > > On 3/30/07, Tim <[EMAIL PROTECTED]> wrote: > > > > > > > -Message d'origine- > > > De : Tijnema ! [mailto:[EMAIL PROTECTED] Envoyé : > vendredi 30 mars > > > 2007 16:56 À : Tim Cc : php-general@lists.php.net Objet : > Re: [PHP] > > > Saving css state in javascript and passing to php via form submit > > > > > > On 3/30/07, Tim <[EMAIL PROTECTED]> wrote: > > > > Hello all, > > > > > > > > I have a little dilemna here: > > > > > > > > I am using php/css/mysql to generate a hierarchical table of > > > > categories and sub-categories and sub-sub.. Etc.. > > > > > > > > A screenshot can be found here: > > > > > > > > http://www.internet46.fr/mehim/screenshot.jpg > > > > > > > > Now i'm also using javascript to hide show blocks of divs > > > to hide/show > > > > sub categories.. Typical.. > > > > > > > > My issue is on page reload, i have a form on the same > page, when a > > > > category is clicked, the categorie info displays and you can > > > > update the info through this form (table and form on > same page). > > > > My issue comes when i post the data, the page comes back and my > > > category tree > > > > folds up which is normal because all divs are set to > > > "display:none;". > > > > > > > > I have managed to pass a post/get called lastclicked > that gets the > > > > nodepath of that element and combined with php to generate > > > javascript > > > > that will unfold the tree and highlight the last > clicked element... > > > > > > > > I would like to go one step further and save the entire > > > state of the > > > > tree, say several parent categories are unfolded and i click a > > > > subcategorie to display my form, i want that entire "state" un > > > > unfolded categories to be displayed not just the clicked > > > category, of > > > > course i can get this state and save it in a javascript > > > array, but my > > > > issue is when i post my form how do i pass that state data > > > generated > > > > by javascript back to the page, to be able to unfold the > > > tree in the state it was previously? > > > > > > > > What are the technologies IF there are any and what should > > > i look up > > > > to find docs that cover this type of datatransfer ie: > > > javascript->php. > > > > > > > > Regards, > > > > > > > > Tim > > > > > > I think you want to use sessions for this :) > > > > Ok, i can put the data in the session variable, but i can > only get the > > "current" state through javascript > > > > ie:onsubmit="getstate()"; which would get the id's of the > blocks that > > are set to display:block; > > > > But in getstate() how do i pass that to php to set that > session variable? > > You could use AJAX to get things from/to PHP, but why should > you? You can use session within javascript too i believe. Hmm javascript setting server-side session data?? Sounds weird, but i'll look into it.. > > > > > Tijnema > > > > > > ps. Maybe you could also use AJAX instead of submitting forms the > > > whole time. > > > > In the next version of my framework i would like to, i still havent > > quite understood the whole concept, not enough research > yet, but yes > > i'll be doing that next ;) (you know deadlines, can't sit > and read docs all day etc.. > > Although i'd rather!) > > > > ;) > > > > Regards, > > > > Tim > > Really, it's not that hard to use AJAX. You might want to > look at www.tizag.com, there it is really easy explained. > It's nothing more then making new request to scripts inside > javascript. Nice tutorial thanks for that, i'll look it up, maybe intergrate it right away, would really make my day if i could :)) Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On 3/30/07, Tim <[EMAIL PROTECTED]> wrote: > -Message d'origine- > De : Tijnema ! [mailto:[EMAIL PROTECTED] > Envoyé : vendredi 30 mars 2007 16:56 > À : Tim > Cc : php-general@lists.php.net > Objet : Re: [PHP] Saving css state in javascript and passing > to php via form submit > > On 3/30/07, Tim <[EMAIL PROTECTED]> wrote: > > Hello all, > > > > I have a little dilemna here: > > > > I am using php/css/mysql to generate a hierarchical table of > > categories and sub-categories and sub-sub.. Etc.. > > > > A screenshot can be found here: > > > > http://www.internet46.fr/mehim/screenshot.jpg > > > > Now i'm also using javascript to hide show blocks of divs > to hide/show > > sub categories.. Typical.. > > > > My issue is on page reload, i have a form on the same page, when a > > category is clicked, the categorie info displays and you can update > > the info through this form (table and form on same page). My issue > > comes when i post the data, the page comes back and my > category tree > > folds up which is normal because all divs are set to > "display:none;". > > > > I have managed to pass a post/get called lastclicked that gets the > > nodepath of that element and combined with php to generate > javascript > > that will unfold the tree and highlight the last clicked element... > > > > I would like to go one step further and save the entire > state of the > > tree, say several parent categories are unfolded and i click a > > subcategorie to display my form, i want that entire "state" un > > unfolded categories to be displayed not just the clicked > category, of > > course i can get this state and save it in a javascript > array, but my > > issue is when i post my form how do i pass that state data > generated > > by javascript back to the page, to be able to unfold the > tree in the state it was previously? > > > > What are the technologies IF there are any and what should > i look up > > to find docs that cover this type of datatransfer ie: > javascript->php. > > > > Regards, > > > > Tim > > I think you want to use sessions for this :) Ok, i can put the data in the session variable, but i can only get the "current" state through javascript ie:onsubmit="getstate()"; which would get the id's of the blocks that are set to display:block; But in getstate() how do i pass that to php to set that session variable? You could use AJAX to get things from/to PHP, but why should you? You can use session within javascript too i believe. > Tijnema > > ps. Maybe you could also use AJAX instead of submitting forms > the whole time. In the next version of my framework i would like to, i still havent quite understood the whole concept, not enough research yet, but yes i'll be doing that next ;) (you know deadlines, can't sit and read docs all day etc.. Although i'd rather!) ;) Regards, Tim Really, it's not that hard to use AJAX. You might want to look at www.tizag.com, there it is really easy explained. It's nothing more then making new request to scripts inside javascript. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Saving css state in javascript and passing to php via form submit
> -Message d'origine- > De : Tijnema ! [mailto:[EMAIL PROTECTED] > Envoyé : vendredi 30 mars 2007 16:56 > À : Tim > Cc : php-general@lists.php.net > Objet : Re: [PHP] Saving css state in javascript and passing > to php via form submit > > On 3/30/07, Tim <[EMAIL PROTECTED]> wrote: > > Hello all, > > > > I have a little dilemna here: > > > > I am using php/css/mysql to generate a hierarchical table of > > categories and sub-categories and sub-sub.. Etc.. > > > > A screenshot can be found here: > > > > http://www.internet46.fr/mehim/screenshot.jpg > > > > Now i'm also using javascript to hide show blocks of divs > to hide/show > > sub categories.. Typical.. > > > > My issue is on page reload, i have a form on the same page, when a > > category is clicked, the categorie info displays and you can update > > the info through this form (table and form on same page). My issue > > comes when i post the data, the page comes back and my > category tree > > folds up which is normal because all divs are set to > "display:none;". > > > > I have managed to pass a post/get called lastclicked that gets the > > nodepath of that element and combined with php to generate > javascript > > that will unfold the tree and highlight the last clicked element... > > > > I would like to go one step further and save the entire > state of the > > tree, say several parent categories are unfolded and i click a > > subcategorie to display my form, i want that entire "state" un > > unfolded categories to be displayed not just the clicked > category, of > > course i can get this state and save it in a javascript > array, but my > > issue is when i post my form how do i pass that state data > generated > > by javascript back to the page, to be able to unfold the > tree in the state it was previously? > > > > What are the technologies IF there are any and what should > i look up > > to find docs that cover this type of datatransfer ie: > javascript->php. > > > > Regards, > > > > Tim > > I think you want to use sessions for this :) Ok, i can put the data in the session variable, but i can only get the "current" state through javascript ie:onsubmit="getstate()"; which would get the id's of the blocks that are set to display:block; But in getstate() how do i pass that to php to set that session variable? > Tijnema > > ps. Maybe you could also use AJAX instead of submitting forms > the whole time. In the next version of my framework i would like to, i still havent quite understood the whole concept, not enough research yet, but yes i'll be doing that next ;) (you know deadlines, can't sit and read docs all day etc.. Although i'd rather!) ;) Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving css state in javascript and passing to php via form submit
On 3/30/07, Tim <[EMAIL PROTECTED]> wrote: Hello all, I have a little dilemna here: I am using php/css/mysql to generate a hierarchical table of categories and sub-categories and sub-sub.. Etc.. A screenshot can be found here: http://www.internet46.fr/mehim/screenshot.jpg Now i'm also using javascript to hide show blocks of divs to hide/show sub categories.. Typical.. My issue is on page reload, i have a form on the same page, when a category is clicked, the categorie info displays and you can update the info through this form (table and form on same page). My issue comes when i post the data, the page comes back and my category tree folds up which is normal because all divs are set to "display:none;". I have managed to pass a post/get called lastclicked that gets the nodepath of that element and combined with php to generate javascript that will unfold the tree and highlight the last clicked element... I would like to go one step further and save the entire state of the tree, say several parent categories are unfolded and i click a subcategorie to display my form, i want that entire "state" un unfolded categories to be displayed not just the clicked category, of course i can get this state and save it in a javascript array, but my issue is when i post my form how do i pass that state data generated by javascript back to the page, to be able to unfold the tree in the state it was previously? What are the technologies IF there are any and what should i look up to find docs that cover this type of datatransfer ie: javascript->php. Regards, Tim I think you want to use sessions for this :) Tijnema ps. Maybe you could also use AJAX instead of submitting forms the whole time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php