FormField#setFieldType doesn't properly switch for DIALOGLIST
jesse-gallagher opened this issue · 0 comments
jesse-gallagher commented
As reported in the Slack chat:
===========================
Hello, I'm trying to figure out way to change all combobox fields type. I've arleady runned this:
Database db = ss.getCurrentDatabase();
for(DesignForm form :db.getDesign().getForms()){
for(FormField field :form.getFields()){
if(field.getFieldType().equals(Type.COMBOBOX)){
field.setFieldType(Type.DIALOGLIST);
}
form.save();
}
}
but it's only changed ui attribute of keyword tag in DXL so field has been broken. Also only field with formula value list have changed and other one with standard choices have not. Have you any idea how properly should I do it?
===========================
Looking at the code, I see there's an obvious bug:
keywords.setAttribute("helperbutton", String.valueOf(fieldType.name().equals("dialoglist")))
fieldType
is an enum and the name is in all caps, and so that equals
check will never be true. It'll take more investigation to see if there's anything else needed, though.