Hi Simone Thanks for that, but we tried using "widget.setRequired(true)" but it reports that "setRequired is not a function".
We are using Cocoon 2.1.7 - is this the problem or is it something else? Thanks > Hi Duncan, > If you are talking about server side javascript (like flow or > fd:on-value-changed) then you can use the setRequired(true) on the > widget(s) you want to make mandatory. In this case, you have to set the > fd:on-value-changed in the radio buttons definition, with a > fd:javascript inside that makes all the needed checks and then looks up > the widgets and calls widget.setRequired(true) on those that must become > mandatory when a certain radio button is selected. > > Also, if it does not happen automatically, set a fi:styling > submit-on-change on those radio buttons, to make sure the form will get > automatically submitted when the user selectes a radio button. > > This techique will cause a page reload, you can make this less annoying > for the user using ajax. > > Hope this helps, > Simone > > > > > Duncan McLean wrote: > >>Hi >> >>Does anyone know how to set a field as required from within a Javascript >>block in a field definition? >> >>We have a set of radio buttons, and depending on which one is selected >>this will influence which subsequent fields are compulsory. >>We've tried to set the "required" attribute of a particular field, but >>this has no effect. >> >>Anybody have any code which does this, or is it impossible? >> >>Thanks >> >>Duncan >> >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > -- > Simone Gianni > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
