instead of using
aObject.b1d=setField(dateid.selectedDate.toDateString())
use
if (dateid != null)
{

if (dateid.selectedDate != null)
{

aObject.b1d=setField(dateid.selectedDate.toDateString())

}

}


---> Akshar Kaul <---



On Tue, Feb 8, 2011 at 14:39, gaurav <g.gaura...@gmail.com> wrote:

> Hi,
> I need a suggestion in my code -
>
> I need to populate an object and send it over http request. During
> population of this object I does pick the values from diffrent type of
> control like - DateField, TextInput, TextArea etc from a form. Now in case
> when user leave those empty those appears as null, which cause nullpointer
> when extracting text from those control by -
>
> dateid.selectedDate.toDateString() ;  //where dateid is id of DateField
> type control
> textid.text; // where textid is id of TextInput type of control.
>
>
> Now - I have created a utility method something like below -
>
> private function setField(theString:String):String{
>     if(theString==null || StringUtil.trim(theString).length ==0)
>       return "";
>     return StringUtil.trim(theString);
>  }
>
> and use it like -
>
> 1. aObject.b1d=setField(dateid.selectedDate.toDateString())
> 2. aObject.fyq=setField(textid.text);
>
> but it'll not work for 1 above because in above example dateid itself will
> null and again a null pointer :( because of calling selectedDate over a null
> refrence.
>
> Is any common solution for this problem which may resolve this issue for
> all kind of controls.
>
> Thanks.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To post to this group, send email to flex_india@googlegroups.com.
> To unsubscribe from this group, send email to
> flex_india+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/flex_india?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to flex_india@googlegroups.com.
To unsubscribe from this group, send email to 
flex_india+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to