Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Date picker in prompt bean plugin? #4019

JShelton ·

Is it possible to enforce a date (and display date picker) for a field within a prompt bean plugin, similar to the variable prompt setting "prompt as date input"? @Date annotation on getter methods seems to have no noticeable effect, and neither does setting return type to Date. My current workaround is making it a string and enforcing a weak regex pattern.

  • replies 7
  • views 24
  • stars 0
#2
JShelton deleted this topic
#3
JShelton restored this topic
robinshen ADMIN ·

You may define it directly as a field of Date type, for instance:

private Date myDate;

public Date getMyDate() {
  return myDate;
}

public void setMyDate(Date myDate) {
  this.myDate = myDate;
}
JShelton ·

In QuickBuild 8.0.11, I do not get a date field when setting the field to Date type. Instead, I get an empty list drop down. I set the field to @NotNull, so it literally just says "Choose One" and the only available option is to "Choose One"

robinshen ADMIN ·

Sorry forget to annotate method "getMyDate" with @Editable

JShelton ·

That is already set. Using @Editable(order=100, name="Date", description="The date").
The annotations don't have to be in a certain order, do they?

robinshen ADMIN ·

It is odd that this is working at my side. What I am doing:

  1. Define a bean for example:
@Editable(name="My Example Bean")
public class MyExampleBean implements Serializable {
	
	private static final long serialVersionUID = 1L;

	private Date myDate;

	@Editable
	public Date getMyDate() {
		return myDate;
	}

	public void setMyDate(Date myDate) {
		this.date = date;
	}
}
  1. Return the bean in plugin's getExtensions method:
public class PromptBeanPlugin extends AbstractPlugin {

	@Override
	public Object[] getExtensions() {
		return new Object[]{
				new PromptBeanProvider() {

					public Class<? extends Serializable> getPromptBeanClass() {
						return MyExampleBean.class;
					}
					
				},
		};
	}

}
  1. Export and deploy the plugin to QB's plugins directory
  2. Restart QB and add a variable prompting as bean input, and specify the bean as "My Example Bean"
  3. Run the configuration, and the bean displays a text input with date choose icon at right side.