But just to understand, you want to refresh your fk field from form present
in the other tabs?

If it is the case I can provide code example how I realize that with the
help of Anthony just ask...

Richard

On Tue, Apr 10, 2012 at 5:03 PM, Cliff <[email protected]> wrote:

> Richard,
>
> I am using jquery tabs.  They work great.  Also a good diagnostic for
> javascript syntax errors because the tabs stop working if the js is broken.
>
> I may have to look harder at components.  Right now I'm using SQLFORM or
> crud to manage the record from the main table and jquery on_change events
> to manage records from foreign tables.
>
> Thanks for the hint on comet_message.  I'll be looking for it as soon as I
> post this.
>
>
> On Tuesday, April 10, 2012 2:40:39 PM UTC-4, Richard wrote:
>
>> why not using jquery ui tabs plugin and web2py component?
>>
>> Richard
>>
>> On Mon, Apr 9, 2012 at 5:40 PM, Derek  wrote:
>>
>> I'd put a warning saying "you have unsaved changes." or perhaps only
>>> allow switching after saving. You could also make your own form, and handle
>>> saving all changes with your controller. Web2py has good defaults, and the
>>> helpers are good for getting a website up and running quickly, but when you
>>> have custom logic needs, you should get your hands dirty by writing your
>>> own code.
>>>
>>>
>>> On Monday, April 9, 2012 6:19:32 AM UTC-7, Cliff wrote:
>>>>
>>>> Using the dog-owner model from the examples, you might have a model
>>>> like this:
>>>>
>>>> db.define_table('dog', Field('dog_name'))
>>>> db.define_table('owner', Field('owner_name'))
>>>> db.define_table('dog_owner',
>>>>   Field('dog_id', db.dog),
>>>>   Field('owner_id', db.owner),
>>>>   Field('owner_plays_fetch_with_****dog', 'boolean)
>>>> )
>>>>
>>>> I like to use tabs to edit a relationship like this on one web page.
>>>>
>>>> I would use an SQLFORM or a crud form on the first tab to present the
>>>> owner data for editing.  This data gets processed in the normal way.
>>>>
>>>> I would put the dog data on a second tab, but use jquery ajax to handle
>>>> changes.  Maybe the dog's name changes, or the owner decides to start
>>>> playing fetch-the-stick with the dog.
>>>>
>>>> The problem with this approach is that you can lose changes made on the
>>>> owner page.  If you, for example, need to edit both the owner's name and
>>>> the dog's name, you might type the owner's new name on tab 1, move to tab 2
>>>> and edit the dog's name, then close the page without going back to tab 1
>>>> and clicking Submit.
>>>>
>>>> There are several possible solutions.
>>>>
>>>> - Put the owner and dog information on separate forms with submit
>>>> buttons.  They may or may not be on different tabs.  The drawback is it
>>>> takes a round trip to the server every time a user switches between dog
>>>> information and owner information.
>>>>
>>>> - Use jquery/ajax on the owner page to record changes as they are made.
>>>>  If the user is making a lot of changes on a form, I'm not sure there is a
>>>> good way to give feedback.
>>>>
>>>> - Use some kind of form-dirty javascript to remind the user to submit
>>>> the form on the first tab if he tries to close the page while it still has
>>>> unsaved changes.
>>>>
>>>> Which approach would you use, or would you handle this in a different
>>>> way?
>>>>
>>>> Thank you.
>>>>
>>>
>>

Reply via email to