|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Adding widget to RepeatingFormField, uses different naming conventionHi, I'm trying to add a CheckBoxList into a RepeatingFormField like so. repeat_form.display(options= {'new_widget' : checkboxlist_widget}) This is fine. I've got it setup in the template to display no worries. On the rendered page the name for the input is 'systemsearch.checkboxlist' (systemsearch is the name of the repeating form,checkboxlist the name of the checkbox widget). The problem this causes though is when the form is submitted, the data doesn't come back attached to the name 'checkboxlist'. It seems the reason for this is the naming convention for input fields in a Repeating form is 'systemsearch-0.checkboxlist'. Is there a way I set the name to the correct format? I know that creating the checkboxlist widget in the __init__ of the repeating form will remove this problem altogether, but I'm trying to avoid this if possible. Cheers --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to turbogears@... To unsubscribe from this group, send email to turbogears+unsubscribe@... For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Adding widget to RepeatingFormField, uses different naming conventionHi, > I'm trying to add a CheckBoxList into a RepeatingFormField like so. > > repeat_form.display(options= {'new_widget' : checkboxlist_widget}) Never seen this, I wasn't aware that you could do that. It might be an unwanted possibility. > > This is fine. I've got it setup in the template to display no worries. > On the rendered page the name for the input is > 'systemsearch.checkboxlist' (systemsearch is the name of the repeating > form,checkboxlist the name of the checkbox widget). > > The problem this causes though is when the form is submitted, the data > doesn't come back attached to the name 'checkboxlist'. It seems the > reason for this is the naming convention for input fields in a > Repeating form is 'systemsearch-0.checkboxlist'. > > Is there a way I set the name to the correct format? > > I know that creating the checkboxlist widget in the __init__ of the > repeating form will remove this problem altogether, but I'm trying to > avoid this if possible. There is something like "strip_name" or some such in tw.forms that might help here. But frankly, I'd say if anything, the behavior is correct. Of course it shouldn't differ from __init__-calls. Diez --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to turbogears@... To unsubscribe from this group, send email to turbogears+unsubscribe@... For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
Re: Adding widget to RepeatingFormField, uses different naming conventionOn Nov 3, 7:55 pm, "Diez B. Roggisch" <de...@...> wrote: > Hi, > > > I'm trying to add a CheckBoxList into a RepeatingFormField like so. > > > repeat_form.display(options= {'new_widget' : checkboxlist_widget}) > > Never seen this, I wasn't aware that you could do that. It might be an > unwanted possibility. > > > > > > > This is fine. I've got it setup in the template to display no worries. > > On the rendered page the name for the input is > > 'systemsearch.checkboxlist' (systemsearch is the name of the repeating > > form,checkboxlist the name of the checkbox widget). > > > The problem this causes though is when the form is submitted, the data > > doesn't come back attached to the name 'checkboxlist'. It seems the > > reason for this is the naming convention for input fields in a > > Repeating form is 'systemsearch-0.checkboxlist'. > > > Is there a way I set the name to the correct format? > > > I know that creating the checkboxlist widget in the __init__ of the > > repeating form will remove this problem altogether, but I'm trying to > > avoid this if possible. > > There is something like "strip_name" or some such in tw.forms that might > help here. But frankly, I'd say if anything, the behavior is correct. Of > course it shouldn't differ from __init__-calls. > > Diez Ok, that's interesting then. The behaviour is definitely different from the __init__ call. Unfortunately I'm not using tosca widgets. It seems that what will be the best idea in this situation is just create the CheckBoxList in the __init__, as I can't afford to be guessing where the checkboxlist data is in the returned data. Ray --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to turbogears@... To unsubscribe from this group, send email to turbogears+unsubscribe@... For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free embeddable forum powered by Nabble | Forum Help |