Re: Reloading a page with new data

2009-08-13 Thread Tom

Thanks Margie, that has set me off on the right direction.  Like
yourself I do not have much experience with javascript, but I guess
this is a great time to learn!  I will investigate both the admin
javascript and jquery to see what the best option is.  I will report
back once I have something useful to say.

Thanks again,

Tom

On Aug 13, 8:26 pm, Margie  wrote:
> I have been able to mimic the admin behavior in my own app.   I
> started off with the admin js functions showAddAnotherPopup and
> dismissAddAnotherPopup.   Study these in the context of how they are
> used in the admin app and they should get you going.  The best method
> for me was to use firebug and put breakpoints at the begninning of
> showAddAnotherPopup and dismissAddAnotherPopup and then print the
> variables in those functions.  They basically encode the id of the
> input that you need filled in in the window name of of the popup
> window, and then when the popup is closed, then return an httpResponse
> that calls dismissAddAnotherPopup() and that extracts the window name
> of the popup, uses it to identify the id where to place the result,
> and then fills in the input appropriately.
>
> It is also useful to put a pdb breakpoint into the admin code in the
> response_add() function, ie:
>
>         import pdb
>         pdb.set_trace()
>
> This will make your server drop into pdb right before sending back the
> response that calls dismissAddAnother().  If you do all of this and
> then click on an "add another" (green "+") in the admin you should be
> able to trace the process they use.
>
> I thought it was all pretty slick myself.  I don't have a ton of
> javascript experience, so am not sure if this is the best way to do
> things or not.  There might be something simpler in jquery, please
> post if you do identify something simpler!
>
> This is not really in the realm of "django", since django doesn't
> really have much to do with the javascript side of things, but still,
> I'd be interested to know how others in this django community are
> creating popup windows that fill in information and then pass it back
> to some "main" window.
>
> Margie
>
> On Aug 13, 9:40 am, Thomas Scrace  wrote:
>
> >
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Reloading a page with new data

2009-08-13 Thread Margie

I have been able to mimic the admin behavior in my own app.   I
started off with the admin js functions showAddAnotherPopup and
dismissAddAnotherPopup.   Study these in the context of how they are
used in the admin app and they should get you going.  The best method
for me was to use firebug and put breakpoints at the begninning of
showAddAnotherPopup and dismissAddAnotherPopup and then print the
variables in those functions.  They basically encode the id of the
input that you need filled in in the window name of of the popup
window, and then when the popup is closed, then return an httpResponse
that calls dismissAddAnotherPopup() and that extracts the window name
of the popup, uses it to identify the id where to place the result,
and then fills in the input appropriately.

It is also useful to put a pdb breakpoint into the admin code in the
response_add() function, ie:

import pdb
pdb.set_trace()


This will make your server drop into pdb right before sending back the
response that calls dismissAddAnother().  If you do all of this and
then click on an "add another" (green "+") in the admin you should be
able to trace the process they use.

I thought it was all pretty slick myself.  I don't have a ton of
javascript experience, so am not sure if this is the best way to do
things or not.  There might be something simpler in jquery, please
post if you do identify something simpler!

This is not really in the realm of "django", since django doesn't
really have much to do with the javascript side of things, but still,
I'd be interested to know how others in this django community are
creating popup windows that fill in information and then pass it back
to some "main" window.

Margie


On Aug 13, 9:40 am, Thomas Scrace  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi all,
>
> My app has a page where you can enter new data into the database through
> a form.  All is working well, except that some of the fields require a
> choice from a drop down menu.  If the choice for these fields the user
> wants is not already in the database then they have to enter that new
> choice.  To facilitate that I have added a little '+' sign next the the
> drop down which opens a new page where they can enter the new choice,
> click save, and go back to the old page.
>
> It does work, but my problem is that, as you would expect, when they go
> back to the original page the new choice does not show up in the drop
> down menu.  You have to refresh the page in order to get it to show up.
>  In addition, my new page shows up in a new tab, rather than a new
> window as I intended (using 'target='_blank').
>
> So, I need a way to:
>
> 1. Open a new window with a specified view.
> 2. On clicking 'submit' in the new window, have the new window close
> down and auto-reload the original page while retaining the information
> already entered in other fields.
>
> It seems like this should be relatively simple, but I cannot find a way
> to do it.  I notice that Django's admin interface allows exactly this
> functionality, and I have attempted to figure out their javascript but
> with no success.  Is there a more simple 'Djangofied' way to do this.
>
> Thanks very much for any help you can offer,
>
> - --
> Tom 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (Darwin)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkqEQgsACgkQqeeO1ChsKHTOrgCg6W7JnbQEJsAXlwI0iYfAJuat
> xe4An36q7vGtGFTzuM+IOF0xQJF10XEe
> =7avd
> -END PGP SIGNATURE-
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Reloading a page with new data

2009-08-13 Thread Thomas Scrace

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,

My app has a page where you can enter new data into the database through
a form.  All is working well, except that some of the fields require a
choice from a drop down menu.  If the choice for these fields the user
wants is not already in the database then they have to enter that new
choice.  To facilitate that I have added a little '+' sign next the the
drop down which opens a new page where they can enter the new choice,
click save, and go back to the old page.

It does work, but my problem is that, as you would expect, when they go
back to the original page the new choice does not show up in the drop
down menu.  You have to refresh the page in order to get it to show up.
 In addition, my new page shows up in a new tab, rather than a new
window as I intended (using 'target='_blank').

So, I need a way to:

1. Open a new window with a specified view.
2. On clicking 'submit' in the new window, have the new window close
down and auto-reload the original page while retaining the information
already entered in other fields.

It seems like this should be relatively simple, but I cannot find a way
to do it.  I notice that Django's admin interface allows exactly this
functionality, and I have attempted to figure out their javascript but
with no success.  Is there a more simple 'Djangofied' way to do this.

Thanks very much for any help you can offer,

- --
Tom 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqEQgsACgkQqeeO1ChsKHTOrgCg6W7JnbQEJsAXlwI0iYfAJuat
xe4An36q7vGtGFTzuM+IOF0xQJF10XEe
=7avd
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---