I'm trying to validate the address of a machine a user enters during installation, by trying to ping the given machine. I'm looking at doing something similar to the following block; but it doesn't work so I'm wondering if it's something that's actually possible. Or something I should be validating differently.

<stringparameter>
    <name>address</name>
    <description>The machines address</description>
    <explanation></explanation>
    <value></value>
    <default>http://</default>
    <allowemptyvalue>1</allowemptyvalue>
    <width>40</width>
    <validationactionlist>
        <runprogram>
            <abortonerror>0</abortonerror>
            <showmessageonerror>0</showmessageonerror>
            <program>${windows_folder_system}\ping</program>
            <programarguments>-n 1 ${gw_address}</programarguments>
        </runprogram>
        <rulelist>
            <platformtest type="windows"/>
        </rulelist>
    </validationactionlist>
</stringparameter>

asked 07 Dec '12, 09:25

A%20Jefferiss's gravatar image

A Jefferiss
56151621
accept rate: 100%


What error are you receiving? With the current code, the validation will never trigger because the action is set to <abortonerror>0</abortonerror>. You could use:

<stringParameter>
    <name>address</name>
    ...
    <width>40</width>
    <validationActionList>
        <runProgram>
            <customErrorMessage>The provided address is not accessible</customErrorMessage>
            <program>${windows_folder_system}\ping</program>
            <programArguments>-n 1 ${gw_address}</programArguments>
             <ruleList>
                  <platformTest type="windows"/>
             </ruleList>
        </runProgram>
    </validationActionList>
</stringParameter>
link

answered 08 Dec '12, 05:17

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

With my original XML I was getting an error saying that stringParameter cannot contain validationActionList at line 16 in my XML.

With the block you've provided I'm getting a error saying that ruleList can't be a child of valiadationActionList...so something higher up in my XML is causing a problem because I haven't had that issue with other validationActionLists's I've used :)

(10 Dec '12, 02:46) A Jefferiss

Moving the ruleList into runPogram like so fixed that issue:

<validationactionlist>
    <runprogram>
        <customerrormessage>The provided address is not accessible</customerrormessage>
        <program>${windows_folder_system}\ping</program>
        <programarguments>-n 1 ${gw_address}</programarguments>
        <rulelist>
            <platformtest type="windows"/>
        </rulelist>
    </runprogram>
</validationactionlist>

The installer built without any issues and is throwing the expected errors now :)

(10 Dec '12, 02:57) A Jefferiss

You are right, I misplaced the ruleList, It is fixed now :)

(10 Dec '12, 03:24) juanjo ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×55
×11
×10
×10

Asked: 07 Dec '12, 09:25

Seen: 1,230 times

Last updated: 10 Dec '12, 03:24