on 08-17-2006 4:07 PM
hi
I have made a input fieldUI element of type date.I want a error to come when user dosenot enter this field .
I am doing it in this fashion:
view.java
//wdInit()
{
this.intialize();
}
//
void intialize()
{
wdContext.currentcontextElement.setInputfield(new Date(0));
}
//void checkMandotry(java.lang.FieldName)
{
all that to generate error message.
}
//onMyActionClick
void onMyActionclick()
{
Date date1=wdContext.currentelement.getAttributeValue();
if(date1.equals(new Date(0))
{
this.CheckMandotry()
}
}
But in my application 01/01/1970 comes by default on my inputfield which i donot want?
How to do this?
Please help me
regards
Nidhideep
Hi
//To Get Blank value in Date Field Use
wdContext.currentcontextElement.setInputfield(null);
//To Get the current Date
wdContext.currentcontextElement.setInputfield(new Date());
Kind Regards
Mukesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
Mukesh ,I was able to solve my problem but a new problem has arised.I have three inputfield of type date.
for eg. orderdate,shipmentdate,mturitydate.My logic is:
onSomeAction
{
if(orderdate ==null||shipmentdate==null|| maturitydate==null)
{
some error arises
}
if(orderdate.before(shipmentdate)||maturitydate.before(shipmentdate)
{
some error arsises
}
But i am getting a Nullpointer exception.
Please help me.
Regards
Nidhideep
Hi
When you check
Before assign the value check the context value is null.
Date orderdate =null;
if(wdContext.current<node>Element().getorderdate()!=null){
orderdate=wdContext.current<node>Element().getorderdate();
}else{
//Do the Rest
}
if(orderdate ==null||shipmentdate==null|| maturitydate==null)
{
//some error arises
}
what error occurs?
//before the condition check the null value
if(orderdate!=null && shipmentdate!=null && maturitydate!=null){
if(orderdate.before(shipmentdate)||maturitydate.before(shipmentdate)
{
//some error arsises
}
}
Kind Regards
Mukesh
Hi Nidhideep,
You are getting NullPointer becaue, you are comparing (before()) with null value.
To Avoid NullPointer you can do this.
<b>if</b>(orderdate == null||shipmentdate == null|| maturitydate == null)
{
//Some Error Msgs
}<b> elseif</b> (orderdate.before(shipmentdate)||maturitydate.before(shipmentdate))
){
//Some Error Msgs
}
Hope it may solved ur problem.
Regards,
Sridhar
Hi,
You can use the below code to check.
If you dont want to see anything in the input field, just dont intialize with any value in the intialize().
Date dd = wdContext.currentContextElement().getDate1();
if(dd == null ){
wdComponentAPI.getMessageManager().reportSuccess("Empty");
checkRequired();
}else{
wdComponentAPI.getMessageManager().reportSuccess("Not Empty");
}
Regards,
Sridhar
Message was edited by: Sridhar kanchanapalli
Message was edited by: Sridhar kanchanapalli
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think you can intialize date attribute with null
Regards
Saravanan K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nidhideep,
Instead of
new Date(0)
use just
new Date()
and it will come with current date.
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.