durusmail: quixote-users: question on OptionSelectWidget
question on OptionSelectWidget
2005-06-16
2005-06-16
question on OptionSelectWidget
Sells, Fred
2005-06-16
I'm not sure if I'm using the OptionSelectWidget correctly.  I need the user
to select Yes/No and have a TextWidget conditionally displayed based on the
choice.  Since I'll have alot of these, I've built my own widget.

The problem that I have is that the OptionSelectWidget action is posting the
form.  Is that what it is supposed to do? I had assumed that it was using
javascript to control the screen.???

Could someone provide a little snippet that shows how to handle the post
resulting from the OptionSelectWidget action?


class YesNoExplainWidget(CompositeWidget):
    def __init__(self, name, title1, default, title2):
        CompositeWidget.__init__(self, name, title=title1)
        explain = TextWidget('explain', 0, title=title2, rows= 6, cols=60)

        yesno = OptionSelectWidget(name='yesno', title = '',value='NO',
                                   options=[('1', 'Yes'), ('0', 'No')],
                                   descriptions=('Yes', 'No'))
        self.widgets.append(yesno)
        option = yesno.value
        if yesno.value in ['1', 'Yes', 'YES', 'yes']:
            self.widgets.append(explain)

....

within_staffing = YesNoExplainWidget('staffbudget','Within Budgeted Staff
Hours', 'YES', 'Explain')

---------------------------------------------------------------------------
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---------------------------------------------------------------------------
reply