Hello...
I am using WebTabs to create "pages" of data entry fields. However, if I enter some data into a field and switch to another tab, the data is not saved unless I press an action button first (before switching tabs) to save the state. The code I am using to create the tabs is as follows: recordEditTabComponent | e tabs sortedList | e := WebElement new. sortedList := self observee abstractor sortedPages. tabs := WebTabs new. sortedList do: [ :each | (each = self observee) ifTrue: [tabs addText: each label attributes: #bold] ifFalse: [tabs addLinkTo: each text: each label view: #edit parameter: 'id' value: self currentRecord id asString ]]. tabs selected: (sortedList indexOf: self observee abstractor currentDesignPage). e add: tabs. ^ e which is a little strange, I guess because the App object is a view of a "page layout" for "fields" that can retrieve their data for a given record, which is what the parameter is being used for. In this way I do not create a domain model object for every page for every record; I re-use the same page layout for every record instead. Any ideas on how to troubleshoot this? Thanks, Rob _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
I forgot to add that I am using WebTabs and not ViewTabs because my tabs are dynamic and can be added and removed at will by the user, so a "static" view would not work...
Rob
On Sat, Jun 14, 2008 at 8:35 PM, Rob Rothwell <[hidden email]> wrote: Hello... _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
In reply to this post by Rob Rothwell
Hi Rob,
I'm just shooting into the blue here, as I don't know how your tabs are implemented. On Sat, 14 Jun 2008 20:35:34 -0400 "Rob Rothwell" <[hidden email]> wrote: > However, if I enter some data into a field and switch to another tab, the > data is not saved unless I press an action button first (before switching > tabs) to save the state. From the seat of my pants, I can only see one way of getting this to work: The complete form would have to be loaded and divided into parts corresponding to the tabs: page form tabs tab1 tab2 tab3 form contents of tab pages div id contents div id tab1 div id tab2 div id tab3 submit button The rest could only be CSS and a tiny bit of javascript, as you'd have to avoid sending back a request to the server, as you'd lose your entered data with it. The default CSS for this page would be div#contents > div { display: none; } div#tab1 { display: block; } to display only the first content page and hide the others. The links of the tabs would only need to update the style properties, e.g. by hiding all of them and displaying only their corresponding div. With this setup, you get the complete form with the original page load, you only see one tab page at a time, your browser remembers your entered data as you switch between tabs, and the final click on the submit button sends the complete form back to the server in one go. Now the question: Do WebTabs work this way? If not, you'd probably have to send the data back to the server piecewise, using onBlur event handlers, but this might become ugly quickly. Just making Smalltalk, s. _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
In reply to this post by Rob Rothwell
Hi Rob,
Rob Rothwell wrote: > I am using WebTabs to create "pages" of data entry fields. > > However, if I enter some data into a field and switch to another tab, > the data is not saved unless I press an action button first (before > switching tabs) to save the state. Pretty known problem. On Aida the simplest solution is just to send #onChangePost to each of your form fields, something like: (e addInputFieldAspect: #name for: self person) onChangePost This will ensure that every field entry or change will be immediately saved to your domain model. But be careful, people can get confused if 'Save' button is remained on the form: did they save changes or not? So in that case it is better not use Save button at all. It seems that such technics is more and more common on the web and in my opinion is more natural as well. Best regards Janko > > The code I am using to create the tabs is as follows: > > recordEditTabComponent > | e tabs sortedList | > e := WebElement new. > sortedList := self observee abstractor sortedPages. > tabs := WebTabs new. > sortedList do: [ :each | > (each = self observee) > ifTrue: [tabs addText: each label attributes: #bold] > ifFalse: [tabs addLinkTo: each text: each label view: #edit > parameter: 'id' value: self currentRecord id asString ]]. > tabs selected: (sortedList indexOf: self observee abstractor > currentDesignPage). > e add: tabs. > ^ e > > which is a little strange, I guess because the App object is a view of a > "page layout" for "fields" that can retrieve their data for a given > record, which is what the parameter is being used for. In this way I do > not create a domain model object for every page for every record; I > re-use the same page layout for every record instead. > > Any ideas on how to troubleshoot this? > > Thanks, > > Rob > > > ------------------------------------------------------------------------ > > _______________________________________________ > Aida mailing list > [hidden email] > http://lists.aidaweb.si/mailman/listinfo/aida -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
In reply to this post by Stefan Schmiedl
On Sun, Jun 15, 2008 at 5:38 AM, Stefan Schmiedl <[hidden email]> wrote:
Hi Rob, In a way, I don't know how my tabs are implemented either, even though I "have all the code" right in front of me! From the seat of my pants, I can only see one way of getting this to The solution Janko suggested is actually an Ajax one, built into the WebElements in the Aida framework. However, it sounds like if I had your background I might be able to troubleshoot why it is not working for me with my WebCheckBox(es)! Thank you for the suggestions, Rob _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
On Sun, 15 Jun 2008 19:57:46 -0400
"Rob Rothwell" <[hidden email]> wrote: > Wow. At some point, I hope to start picking up the details of "how the web > works," for when I need to drop down lower than the level of Aida (CSS, > Javascript). For now, though, I am still trying to just figure out the Aida > framework! Actually, the part you're working on is quite simple: A form is a container for input fields in various guises. Submitting the form (by clicking on a submit button) sends off a request to the server, which carries all input field names and entered values. All fields that are kept inside the form. With this in mind, I think your problem with tabs comes from the tab links replacing the previous contents with their own tab page, hence losing you the input. The CSS/visibility hack loads the complete form but displays only a part of it. The invisible fields are still part of the form and are transmitted upon submit. > > The solution Janko suggested is actually an Ajax one, built into the > WebElements in the Aida framework. However, it sounds like if I had your > background I might be able to troubleshoot why it is not working for me with > my WebCheckBox(es)! Told you it might get ugly .-) I was thinking about validating the input however. Just making Smalltalk, s. _______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida |
Free forum by Nabble | Edit this page |