I checked the js returned from controller function.
It is----
selbx('edit_freq','daily');

selbx function is there in the View.

-- Vineet

On Nov 8, 7:04 pm, Vineet <[email protected]> wrote:
> Something is wrong in the function.
> I defined a test js function in View.
>
> function alrt(mesg) {
> alert(mesg) };
>
> And in Controller,
> return "alrt('Hello World!');"
>
> It works.
>
> The actual js function is---
> (it sees which value of select box matches the one returned from
> controller; then sets the value of select box to that value).
>
> function selbx(elementID, value_returned_from_dataset){
>             for (i=0;i<document.getElementById(elementID).length;i++)
>              {
>                 if (value_returned_from_dataset ==
> document.getElementById(elementID).options(i).text)
>
> {document.getElementById(elementID).options(i).selected = true;
>
>                      }}}
>
> In controller---
> return "selbx('id_of_element','%s');" % dict_obj['freq']
>
> dict_obj['freq'] is non-blank.
> It is a string itself.
> ****************************************
> If individual code-lines are returned, it works.
> ****************************************
>
> Any guess why so?
>
> Regards,
> Vineet
>
> On Nov 8, 6:44 pm, Anthony <[email protected]> wrote:
>
>
>
> > On Tuesday, November 8, 2011 8:17:41 AM UTC-5, Vineet wrote:
>
> > > > If 'myvar' is a Python variable, you're going
>
> > > 'myvar' is a not a python variable.
> > > I pass the id of html element as argument.
> > > Javascript code sets the value of that html element.
>
> > OK, but same problem -- 'myvar1' isn't a javascript variable either -- it
> > is a string identifying an html element. So you would still have to return
> > 'abc("myvar1")', or maybe 'abc("#myvar1")', depending on how you are using
> > it in the code.
>
> > Anthony- Hide quoted text -
>
> - Show quoted text -

Reply via email to