[izpack-users] NotEmptyValidator and PortValidator issue for input field..

Ajay Kumar Gour ajay.g at s7solutions.com
Fri Jan 4 08:04:15 CET 2008


Hello All,

Iam trying to use NotEmptyValidator for the validation in UserInputPanel  
for a field. But when i run the installation it doesn't prompt the error  
message (i tried both the events for inout field i.e. focus lost and Next  
button press on input panel) if i leave the field empty. Actually, i want  
to use PortValidator to check if port is free or not, so i used <validator  
class="com.izforge.izpack.util.NotEmptyValidator" txt="Port is not  
available" /> initially. But it didn't work so i thought of using  
NotEmptyValidator first to make sure iam giving all the required  
attributes. But even NotEmptyValidator is not working. Can anybody help me  
in sorting both the above mentioned issues?

Here is my UserInputSpec.xml file -

<userInput>
<panel order="0">
	<!--field type="staticText" align="left" txt="My comment is here."  
id="input.comment"/-->
	<field type="text" variable="PORT">
		<spec txt="Proxy Port:" id="PORT" size="5" set="" layout="N:5:5"/>
		<validator class="com.izforge.izpack.util.NotEmptyValidator"  
txt="Error"/>	
	</field>
</panel>
</userInput>

My configuration file -

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<properties>
	<category name="general">
		<property name="PORT" value=""/>
	</category>
</properties>

And finally, install.xml

<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>

<installation version="1.0">
      <info>
          <appname>Connector Server</appname>
          <appversion>1.0</appversion>
          <authors>
              <author name="Jason Rolles"
email="ajay.g at s7solutions.com"/>
          </authors>
          <url>http://www.s7solutions.com</url>
      </info>

	<variables>
		<variable name="PORT" value="9999"/>
	</variables>

      <guiprefs width="640" height="480" resizable="no"/>

      <locale>
          <langpack iso3="eng"/>
      </locale>

      <resources>
          <res id="LicencePanel.licence" src="Licence.txt"/>
          <res id="InfoPanel.info" src="Readme.txt"/>
          <res id="userInputSpec.xml" src="userInputSpec.xml"/>
      </resources>

      <panels>
          <panel classname="HelloPanel"/>
          <panel classname="InfoPanel"/>
          <panel classname="LicencePanel"/>
          <panel classname="TargetPanel"/>
          <panel classname="UserInputPanel"/>
          <panel classname="PacksPanel"/>
          <panel classname="InstallPanel"/>
          <panel classname="FinishPanel"/>
      </panels>

      <packs>
          <pack name="Base" required="yes">
              <description>The base files</description>
              <file src="Readme.txt" targetdir="$INSTALL_PATH"/>
              <file src="Licence.txt" targetdir="$INSTALL_PATH"/>
              <file src="script.bat" targetdir="$INSTALL_PATH"/>
              <file src="myconfiguration.xml" targetdir="$INSTALL_PATH"/>
              <parsable targetfile="$INSTALL_PATH/myconfiguration.xml"
type="xml"/> <!-- The file will be parsed -->
              <parsable targetfile="$INSTALL_PATH/script.bat"/> <!-- The
file will be parsed -->
          </pack>
          <pack name="Docs" required="no">
              <description>The documentation</description>
              <file src="doc" targetdir="$INSTALL_PATH"/> <!-- Reccursive
adding -->
          </pack>
          <pack name="Sources" required="no">
              <description>The sources</description>
              <file src="src" targetdir="$INSTALL_PATH"/>
          </pack>
      </packs>
</installation>

Thanks,
-Ajay


More information about the izpack-users mailing list