Hello again,
I am having an issue when trying to use a NumberTextField in my module’s web page.
I get the following error:
[code]Last cause: java.lang.Double cannot be cast to java.lang.String
WicketMessage: Exception ‘java.lang.Double cannot be cast to java.lang.String’ occurred during validation org.apache.wicket.validation.validator.RangeValidator on component 20:config-contents:antenna-connect-form:antenna-name
[/code]
which occurs on my NumberTextField component.
My html and java files are as follows:
[code]<?xml version="1.0" encoding="ISO-8859-1" ?>
Add New Connection
Antenna ID:
<h1>Remove Connection</h1>
<form wicket:id="antenna-remove-form">
<p>Antenna ID:</p>
<input wicket:id="remove-antenna-name" type="number" />
<input wicket:id="remove-button" class="savebtn" type="submit"
value="Remove Antenna" />
</form>
</wicket:extend>
[/code]
[code]
…
//components for adding new antenna connection form
Form addform = new Form(“antenna-connect-form”);
TextField IP_ADDRESS = new TextField(“ip-address”, new Model(“ip address”));
TextField PORT = new TextField(“port”, new Model(“port”));
NumberTextField ANTENNA_ID = new NumberTextField(“antenna-name”, new Model());
Button addButton = new Button(“submit-button”){
public void onSubmit(){
try {
LRSManager.addNewAntenna(IP_ADDRESS.getValue(), Integer.parseInt(PORT.getValue()), Integer.parseInt(ANTENNA_ID.getValue()));
LRSManager.DBConnectAdd(LRSManager.getByID(Integer.parseInt(ANTENNA_ID.getValue())));
} catch (Exception e) {
logger.error("error: " + e.toString());
}
}
};
…[/code]
I am not sure why this is happening and I can’t seem to find the same error online. Could I be using the NumberTextField incorrectly? If so, how can I make the field so that the only valid input is integers?