RE: Saving css state in javascript and passing to php via form submit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:ceo@xxxxxxxxx] 
> Envoyé : dimanche 1 avril 2007 07:39
> À : Tim
> Cc : php-general@xxxxxxxxxxxxx
> Objet : Re:  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...
> 
> <form id="styles_saver" ...>
>   <input type="submit" onclick="save_styles();" /> </form> 
> <script type="text/javascript"> 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();
> </script>
> 
> 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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux