Tag Archives: inputText

How To in Jdeveloper ADF – To have hour and Time format restriction for inputText


How to have a Time format restriction for the adf inputText component?


To have the time format restriction to restrict the time for upto 23:59 we will have a regex pattern for the af:inputText

<af:inputText label="" id="time" simple="true" value="" contentStyle="width:30px;" maximumLength="5">
<af:validateRegExp pattern"([01][0-9]|2[0-3]):[0-5][0-9]" messageDetailNoMatch="Time Format must match HH:MM" hint="Time Format: HH:MM"/>

How To in Jdeveloper ADF Tutorials- reset the inputText component values

Sometimes the value of the inputText component is not refreshed and the value that was previously entered will still persist within the component. To overcome this issue. we have to use the resetValue() method to reset the component value and display the components intial state

What it does:

  • Get handle to the inputText component using the JSFUtils find component method with the inputText id passed as a parameter
  • set the submitted value of the inputText as null
  • reset’s the input component value
  • refresh the component
private void resetInputText(String id) { 
RichInputText input = (RichInputText)JSFUtils.findComponentInRoot(id); 


This method is used to reset the inputText component value’s in a popup, af:formlayout, af:table.

af:autosuggestBehavior – intro

This component in adf is used to provide a declarative way of providing suggestions for adf input components
the three main attributes are
suggestItems – mapped to a bean which returns List of SelectItems.
maxSuggestedItems – number of suggestedItems. -1 will fetch everything from the server. if the number is limited then a more link is displayed to fetch remaining items from the server
smartList – this list is added to show intial result. then the entire result from the server is fetched if no operation is done by the user

problem: I have a destination inputText which takes city/state combination. I want to implement an autosuggestbehavior for the inputText. When I enter more than three character the suggestion box should appear which City/States.

1) create an af:inputText, the value of the inputText is mapped to a managedBean to store the value that is entered by the user

<af:inputText label="Destination" id="end"
contentStyle="width: 133px;margin-left:5px;"

//managedbean code
private String dest;
public void setDest(String dest) {
this.dest = dest;

public String getDest() {
return dest;

2) now add an af:autosuggestbehavior tag to the inputText. This takes two attribute values. suggestItems and maxSuggestItems. provide maxSuggestItems as ‘5’ to display 5 values. suggestItems is bounded to the managedbean with a method ‘destination’ which returns a List of SelectItems.

<af:inputText label="Destination" id="end"
<af:autoSuggestBehavior suggestItems="#{mapBean.destination}"

public List destination(FacesContext facesContext,
AutoSuggestUIHints autoSuggestUIHints) {
//create suggestion list
List<SelectItem> items = new ArrayList<SelectItem>();
// the list should activate after three character
if(autoSuggestUIHints.getSubmittedValue().length() >= 3){
//get the binding from the pagedef
DCIteratorBinding bindings = getIteratorBinding("CityStateIterator");

OperationBinding operation = null;
String value = autoSuggestUIHints.getSubmittedValue();

//executing the operation binding that will execute a viewcrtieria from ViewImpl
operation = bindings.getBindingContainer().getOperationBinding("searchByCityState");
//bind variable for city and state
String city = value.substring(0, value.indexOf(","));
String state = value.substring(value.indexOf(","), value.length());
operation.getParamsMap().put("city", city);
operation.getParamsMap().put("state", state.replace(", ", ""));
//execute the view criteria

if (operation.getResult() != null) {
RowSet result = (RowSet) operation.getResult(); // cast to the expected result type
//the result is stored in the list
items = populateSuggestionList(items, result);
//show suggestions
return items;
//populate the values in a List of SelectItems
private List<SelectItem> populateSuggestionList(List<SelectItem> items,
RowSet vo) {
//populate the suggestion items
RowSet rs = vo.getRowSet();
while (rs.hasNext()) {
Row rw = rs.next();
items.add(new SelectItem(rw.getAttribute("CITY").toString().trim() + ", " + rw.getAttribute("STATE").toString().trim(),
((String)rw.getAttribute("CITY")).trim() + ", " +

return items;


to learn more you can refer these links

f:convertnumber for decimal numbers

I was working on to filter the decimal value using the QBE feature in the af:table but was facing an issue with the conversion and filtering the values

as you all know that we use the custom filter QBE to filter custom types other than String using the snippet



<f:facet name="filter">
 <af:inputText label="2" id="it2" value="#{vs.filterCriteria.id}">
 <f:convertNumber groupingUsed="false" integerOnly="true"/>


I thought of filtering the decimal values using the option available in af:convertNumber



<f:facet name="filter">
 <af:inputText label="2" id="it2" value="#{vs.filterCriteria.id}">
 <f:convertNumber groupingUsed="false" maxFractionDigits="2" patter="#.##" minFractionDigits="1" maxIntegerDigits="1"/>


But the above options didn’t work as expected.

Finally I found the way to filter the double values using convertor=”javax.faces.Double”



<f:facet name="filter">
 <af:inputText label="2" id="it2" value="#{vs.filterCriteria.id}" convertor="javax.faces.Double"/>