This might be a little too generic to actually be a posted here, but since I
am using JQuery (just got started) in a pretty advanced project right now, I
post it here to you, been lurking around here for a short while and seems
like you are all very knowledgable.

Formless state. I would like my app to have just that. I.e not a
(multiselect) listbox but rather a div where I spit out selections 
http://www.nabble.com/file/4208/Cropper%20Capture%5B13%5D.png  
and a simple href (Ändra, swedish for change) for changing (which throws up
a thickbox). 
So I have a js state object -  "myState" containg the state (array of
selections). All is working fine. The state also contains some other state,
such as current page number and current sort order for some other elements. 
When state changes (i.e user selects some other criteria, goes to next/prev
page) I update some parts of the GUI using ajax.

However - here's my problem. So far I have been handcrafting the ajax url
from the myState variable, and GETting the data. To make it more generic I
would like to have a generic "serialize" of the myState object and post it
instead. Then I could easily add more variables to the "state"  without
needing to update all places where retrieve new data.  

My real question is:  since I am pretty new on the JS/Ajax scene - is my
approach a good idea at all (i.e to have "formless" state) - would you
instead create invisible form fields for keeping state and updating the
"fancy divs" from the state of the those hidden form fields instead and then
use the existing form plugin etc when posting  etc.

I am starting to feel that's the way to go - I also think browser history
would be more consistent that way - the myState is of course cleared on
forward/back - but I do have some regular dropdowns which semms to keeps
their selection. Is that also correct?

I have spent an embarrassing amount of time on these type of problems -
which are new to me since I have only spent all my time serverside before -
however learning takes time, I guess... 

 

-- 
View this message in context: 
http://www.nabble.com/Formless-%28or-hopeless%29-programming-model-tf2650594.html#a7396830
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to