Meteor: Showing extra sign up field conditionally using meteor-accounts-ui-bootstrap-3 -
i using meteor-accounts-ui-bootstrap-3 create sign form. in sign form have 2 options doctor , advisor. if during sign process user selects doctor want show more fields (required fields) based on selection , if user select advisor field should remain hidden. below code of sign form:
accounts.ui.config({ requestpermissions: {}, extrasignupfields: [{ fieldname: 'phone', fieldlabel: 'phone number', inputtype: 'text', visible: true, validate: function(value, errorfunction) { if (!value) { errorfunction("please write phone number"); return false; } else { return true; } } }, { fieldname: 'type', showfieldlabel: false, fieldlabel: 'user type', inputtype: 'radio', radiolayout: 'vertical', data: [{ id: 1, label: 'doctor', value: 'doctor' }, { id: 2, label: 'advisor', value: 'advisor', }], validate: function(value, errorfunction){ if (!value) { errorfunction("please select user type."); return false; } else { return true; } }, visible: true }, { fieldname: 'terms', fieldlabel: 'i accept terms , conditions', inputtype: 'checkbox', visible: true, validate: function(value, errorfunction){ if (value != 'true') { errorfunction("you must accept terms , conditions."); return false; } else { return true; } }, savetoprofile: false }]
});
how can show more fields if user selects "doctor" ? how should add condition in above code ? example if radio type field value doctor want show more fields zip code , date of birth.
any highly appreciated learning meteor.
Comments
Post a Comment