Good evening!
I was trying out the Ajax RemoteForm widget with a multiple checkbox
field (CheckBoxList). I got everything working fine except that I
could not get the form to return multiple selections. I checked the
output to my action function and it showed that the dictionary
returned to it only contained one selected item.
I tried this with a MultipleSelectField widget, and it behaves the
same way.
If I use a regular HTML form, the multiple-widgets return all the
selected items, like they're supposed to.
Am I doing something wrong here, or does the RemoteForm widget ignore
multiple selections?
Cheers,
Martin
-------------------------------------------------------------------
Example code below (I hope I didn't screw up the formatting too much):
in controller.py:
@expose("testproject.templates.testajax")
def testajax(self, **kwargs):
fieldlist = [TextField('testtext'),
MultipleSelectField( 'select_users', options=[ (1,'user 1'), (2, 'user
2'), (3, 'user 3')], default=[5,4],label=u'Select Users') ]
ajaxform = RemoteForm(name="ajaxtest", fields=checkboxlist,\
submit_text="ajax it!",
action='formresults',\
update='post_data')
return dict(form=ajaxform)
@expose()
def formresults(self, **kwargs):
print'\nFormresults:\n'
print repr(kwargs) #print data from RemoteForm to console
return ('Users selected: %r' %(kwargs))
#this should return the textfield text and all selected items
in the MultipleSelectField, but it doesn't
And the testajax.kid has this bit in it:
<div>
-------------------------------------
<span py:replace="form.display()"><br/>The form goes here<br/>
</span>
-------------------------------------
<div id="post_data"> </div>
</div>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---