Child question + illegal start of expression error  
Author Message
cliveswan@yahoo.co.uk





PostPosted: 2007-4-17 4:52:00 Top

java-programmer, Child question + illegal start of expression error I have a form with a question and child questions

eg q1 program - Yes/no
q2 web; desktop
q3 java; .net; #C

My form is:
Q6a: Waterproblem (yes/NO)
Q6b: Current - radiobutton (curent, 1-5 years)
Q6c: Location Home (yes/No); Garden (Yes/No); common (yes/no)

If user selects Q6a = Yes (1)
....
Q6c Home (0/1); Garden (0/1); common (0/1)

I want to check, if user selects Yes for Q6a, then they need
select 1 from Q6c.
If they don't select one choice, want to have a simple error warning.

Yes = 1 No = 0

The code shows an illegal start of expression error????
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

if( page8.getWasteWaterProblem() == 1 ) ||
(getWasteWaterLocationProblemHome() == 0) ||
(getWasteWaterLocationProblemGarden() == 0) ||
(getWasteWaterLocationProblemCommonArea() ==0){

validationResultPage8.addWarning("WasteWaterProlemHome", "warning for
WasteWaterProlemHome from type 6c");
}

 
Eric Sosman





PostPosted: 2007-4-17 5:08:00 Top

java-programmer >> Child question + illegal start of expression error email***@***.com wrote On 04/16/07 16:51,:
> I have a form with a question and child questions
>
> eg q1 program - Yes/no
> q2 web; desktop
> q3 java; .net; #C
>
> My form is:
> Q6a: Waterproblem (yes/NO)
> Q6b: Current - radiobutton (curent, 1-5 years)
> Q6c: Location Home (yes/No); Garden (Yes/No); common (yes/no)
>
> If user selects Q6a = Yes (1)
> ....
> Q6c Home (0/1); Garden (0/1); common (0/1)
>
> I want to check, if user selects Yes for Q6a, then they need
> select 1 from Q6c.
> If they don't select one choice, want to have a simple error warning.
>
> Yes = 1 No = 0
>
> The code shows an illegal start of expression error????
>
>
> if( page8.getWasteWaterProblem() == 1 ) ||
^

The test portion of the `if' statement ends at
this parenthesis. What follows should be an executable
statement, but what actually follows is `||'. `||' is
not valid as the start of an expression or statement.

Possible cure: Delete that parenthesis. Alternative
cure: Insert an opening parenthesis just before `page8'.
Either way, you will also need to add another closing
parenthesis just before the `}' below.

Still another cure: Get rid of all the parentheses
except the one right after `if', the one right before
`}', and the pairs after each method call.

> (getWasteWaterLocationProblemHome() == 0) ||
> (getWasteWaterLocationProblemGarden() == 0) ||
> (getWasteWaterLocationProblemCommonArea() ==0){
>
> validationResultPage8.addWarning("WasteWaterProlemHome", "warning for
> WasteWaterProlemHome from type 6c");
> }

Note, too, that the logic is flawed: The test (after
correction) will produce a validation warning if the
first box is checked or if any of the others is unchecked.
From your description, I doubt that's what you want.

--
email***@***.com

 
Lew





PostPosted: 2007-4-17 7:16:00 Top

java-programmer >> Child question + illegal start of expression error Eric Sosman wrote:
>> I have a form with a question and child questions

email***@***.com wrote On 04/16/07 16:51,:
> Note, too, that the logic is flawed: The test (after
> correction) will produce a validation warning if the
> first box is checked or if any of the others is unchecked.
> From your description, I doubt that's what you want.

Also note that multi-posting causes people to answer your questions without
knowledge of each other's answers and is very rude, as it makes those of us
who try to help feel that you have taken advantage of us and caused us to
waste our time.

Please do not multi-post.

> Lew wrote:
>> Clive wrote:
>>> if( page8.getWasteWaterProblem() == 1 ) ||
>> . . .
>>> Shows an illegal start of expression error????
>>
>> You're not allowed to put the OR operator (||) after the closing
>> parenthesis of the condition.

--
Lew