Ok Martyn, understood.
Mainly that piece of code represents many functions, one inside the
other, since you need to reuse one, than you could declare this inner
function that you are aiming at, outside the event and call it on the
event(s) (in your case onchange and document ready).
That way you will have to write this function only once.
What do you think?

[]s
Diego Ucha

Declare it somewhere else, and call him from the event

On 20 maio, 05:59, martyn <[EMAIL PROTECTED]> wrote:
> In fact, at the creation, you select a category, the the
> subcategories
> are shown. It's OK
>
> /*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-
> ===Create_Object===
>
> Category
> [--select_category--]
>
> SubCategory
> [--select_subcategory--]
>
> /*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-
>
> But, at the modification / edition of an object, I have to set the
> right category and the right subcategory.
>
> /*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-
> ===Edit_Object===
>
> Category
> [--shoes--]
>
> SubCategory
> [--pretty_shoes--]
>
> /*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-/*-
>
> All I want is not to right the same javascript code twice
> (on_selectlist_change == on_document_ready)
> I don't know the better way to do this in django FW.
> The only thing I did is to right the same code twice... It's not the
> DRY philosophy of Django.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to