Hi,

I got it to work. I had to define a separate JS file and call the
function on click event in the button.

so, in my case, I had a file cs.js

function cs_func()
{
      var v1 =
document.getElementById("toggleid").getAttribute("toggled");
      var url = "up.groovy?toggleval=";
      url += v1;
      location.href = url;
}

In my up.gtpl file, I made the following:


<a type="button" class="whiteButton" onclick="cs_func()"
href="#">update</a>

This way, I got it to call the servlet with the actual toggle value.

If there is any other easy way, please let me know.

Thanks
Sriram


On May 3, 9:33 am, sri <[email protected]> wrote:
> Hi,
>
> I have a script (.gtpl) that has a toggle button snippet. I have an
> onClick=alert(message), which works fine. But if I replace alert with
> my function, it does not get called.
>
> The objective is to check whether the toggle button was clicked and
> change the 'ON" to OFF (if it was previously ON) in a variable.
>
> I looked at ibm developer's site. The code there gives script errors.
>
> Thanks much for your help
> Sriram
>
> --
> You received this message because you are subscribed to the Google Groups 
> "iPhoneWebDev" 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 
> athttp://groups.google.com/group/iphonewebdev?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" 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/iphonewebdev?hl=en.

Reply via email to