提交 e54c452c 编写于 作者: J Jesse Glick

f:select works fine with form binding; giving up on f:radioBlock.

上级 10cdcdd5
......@@ -29,6 +29,7 @@ import hudson.XmlFile;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.util.FormApply;
import hudson.util.ListBoxModel;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
......@@ -138,9 +139,9 @@ import org.kohsuke.stapler.StaplerRequest;
@Override public String getDisplayName() {
return "Choice Entry";
}
public String[] getChoices() {
return new String[] {"good", "bad", "ugly"};
public ListBoxModel doFillChoiceItems() {
return new ListBoxModel().add("good").add("bad").add("ugly");
}
}
......
......@@ -25,7 +25,8 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<j:forEach var="choice" items="${descriptor.choices}">
<f:radioBlock name="choice" value="${choice}" title="${choice}" checked="${instance.choice == choice}"/>
</j:forEach>
<f:entry field="choice" title="Choice">
<f:select/>
</f:entry>
<!-- TODO figure out if f:radioBlock can also be used for form binding: Failed to instantiate class java.lang.String from {"value":"good"} -->
</j:jelly>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册