Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to set the field to null without showing the number 0

Status
Not open for further replies.

Ngai88

Programmer
Sep 8, 2004
56
US
Hello,

I have these 3 selections:
Active: # (some number)
Standby: ## (some number)
Demoblization: # (some number)

If for reasons that any of these choices I do noT fill in a number, it throws me to an error page. This means I have to set it in the code to make sure if there is no number put in a null value. Now I do not want to show a '0' value if there is no number entered and not throw me to the error page when I hit the 'submit' button.
Any suggestion ?

thanks,
Ngai
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<table class="one">
<tr>
<td class="description" rowspan="3">Negotiated Rates Each </td>

<td class="description">ACTIVE</td>
<td class="tableCell">
<input type="text" name="sRate1" size="15" value='<expresso:AttributeTag name="RATE_HOUR"/>'>
</td>
<td class="tableCell" rowspan="3">
<input type="radio" name="rbBuy" value="L" checked>&nbsp;Lease
<br>
<input type="radio" name="rbBuy" value="C">&nbsp;Capital
<br>
<input type="radio" name="rbBuy" value="E">&nbsp;Expendable
</td>
<td class="description" rowspan="2">Quantity to Acquire</td>
<td class="tableCell" rowspan="2">
<input type="text" name="quant" value="1" maxlength="5" size="10">
</td>
</tr>
<tr>
<td class="description">STANDBY</td>
<td class="tableCell">
<input type="text" name="sRate2" size="15" value='<expresso:AttributeTag name="STNDBYRATE_HOUR"/>'>
</td>
</tr>
<tr>
<td class="description">DEMOBILIZATION</td>
<td class="tableCell">
<input type="text" name="sRate3" size="15" value='<expresso:AttributeTag name="RATE_DEMOB"/>'>
</td>
<td class="submit" colspan="2">
<input type="submit" name="Submit" value="Order">
</td>
</tr>
</table>
 
Are you asking how to check if a value is null or how to ensure that a value is selected ?



--------------------------------------------------
Free Database Connection Pooling Software
 
I set it up with String ACTIVE_DEFAULT = "0" , when the field is left blank, then hit submit, it still goes to the error page, what is your suggestion?


private static String ACTIVE = PTBSResConfig.ACTIVE;
public final static String ACTIVE_DEFAULT = "0";


protected void runDisplaySearchCriteriaState(ControllerRequest request, ControllerResponse response) throws ControllerException {

if (log.isDebugEnabled()) {
log.debug("Creating inReleased");
}

inReleased.addValidValue(ACTIVE, "Show Active");
inReleased.setDefaultValue(ACTIVE_DEFAULT);
block.add(inReleased);
}


Thanks,
ngai
 
Are you asking how to check if a value is null or how to ensure that a value is selected ?



--------------------------------------------------
Free Database Connection Pooling Software
 
If I ask if a value is null ( that is a blank field) what I have obviously does not work. I need some one to tell me what is the correction.

Thanks
Ngai
 
Thanks anyway, I just need to go into my java code and
and take care of the null string.

Ngai
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top