hi Colin,

My apologies if i came out as been naive and ungrateful. I was just under a
lot of presssure here and just wanted a quick fix - my apologies sincerely.
After taking a break off the work load and having my mind cleared i feel so
stupid for such a reply from me.

So i retract my initial comment. Thanks for taking the time to elaborate on
the possible way of going about this. I will take some time to implement
something - based on your suggestions and let you know the outcome.

Thanks once again and my apologies



Colin Guthrie-6 wrote:
> 
> dele454 wrote:
>> Thanks for the tips. But i CAN'T apply any of them now. The design has
>> been
>> approved and i need to i implement things as they are. 'Over engineered'
>> - I
>> dont care. As long my code works as expected. I simply want to pass my
>> PHP
>> array into my javascript function. - very simple code i dont see why i
>> need
>> to implement a library just for that.
> 
> I wasn't suggesting you change the visual design, or do you mean a 
> different kind of design?
> 
> Do you allow the user to select some pictures and not others? If so your 
> delete multiple button does not work as you pass the *gallery* id, not 
> the list of selected picture ids.
> 
> If you do not allow the user to select some and not others, then there 
> is no point in producing the individual checkboxes next to the pictures, 
> just use a "Delete gallery" button and be done with it.
> 
> I've explained how you would implement a form that could happily accept 
> an array of selected picture ids so there is little more help I can give 
> you are not going to follow that route.
> 
> I have explained also how to pass a PHP array into JS, but as I said 
> before, this is almost certainly not what you want to do to achieve this 
> kind of interface.
> 
> What you actually have is a list of selected items in javascript and you 
> want to pass that back to PHP as an array! it's precisely the other way 
> around. This is easily possible and by naming the checkboxes as you have 
> you are very much on the right route, but you should allow the form to 
> be submitted naturally, do not try to force it via a window.location = 
> 'blah' hack. If you insist on doing this then you will have to cycle 
> through the elements of the form with the specific name and append 
> "&delete[]=ID" multiple times to your URL (or /delete/ID multiple times 
> if you've wrapped up the URL parsing in a ZF route appropriately).
> 
> But trust me. Use a form. Use POST, submit it normally with an onsubmit 
> confirmation function. (you could also submit the form by calling the 
> submit() method on the form itself, but this will prevent your interface 
> working on browsers which have JS disabled - my recommended way would 
> work just find without javascript, albeit sans a warning).
> 
> Col
> 
> 
> Col
> 
> -- 
> 
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
> 
> Day Job:
>    Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>    Mandriva Linux Contributor [http://www.mandriva.com/]
>    PulseAudio Hacker [http://www.pulseaudio.org/]
>    Trac Hacker [http://trac.edgewall.org/]
> 
> 
> 


-----
dee
-- 
View this message in context: 
http://www.nabble.com/Passing-an-array-from-PHP-to-Javascript-tp19511848p19520162.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to