Hi have the following situation (example code only)

Controller:

@expose(template = "bddb.templates.testing")
@expose('json')
def view(self):

        a_select =
widgets.MultipleSelectField(options=['1','2','3','4','5'],label="Select
your file",name="a")
        email_field =
widgets.TextField(name="email_address",label="Please enter email")
        button_field = widgets.Button(name="submit",label="Submit")
        return dict(header = "Test",
                    pagetitle = "Test",
                    description = "",
                    menu = "",
                    a_select=a_select,
                    email_field=email_field,
                    button_field=button_field)


html:

div id="form">Please select your file from the list${a_select()}<br /
>your email-address &nbsp;${email_field()}<br />$
{button_field(value="submit", id="sumbit")}</div>
        <div id="results"/>
        <div id="IMG"/>

javascript:

<script type="text/javascript">
    addLoadEvent(function(){

        connect($('submit'),'onclick',function(e) {
            e.preventDefault();
            hideElement("form")

            var img = document.createElement('img');
            img.onload = function (evt) {
                document.getElementById('IMG').appendChild(img);
            }
            img.src = '/static/images/dna_e0.gif';


            var selectedoptions = [];
            $('#a :selected').each(function(i, selected) {
            selectedoptions[i] = $(selected).val();
             });;

            var email = getElement("email_address").value;

            var d = loadJSONDoc("${tg.url('/test/results')}",
{'tg_format':'json','email':email,'a':JSON.stringify(selectedoptions)});
            d.addCallback(showResults);
        });
    });

    function showResults(responce) {
        hideElement("IMG")
        var results = $("results");
        replaceChildNodes(results,'YES')
            }

    </script>


currently I am not getting all options from the multiselect, I tried
the above code but  $('#a :selected') return null.
Any help please

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

Reply via email to