want to know if any validation exists

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

want to know if any validation exists

soumya jyoti guru
Hi all,
        I  am facing a problem while validating two dates used in the
same form (start date, end date).I have written a code
for create and there I had included two fields named as start date and
end date.
       The problem is that the data gets created even if the start
date=2010-09-30 and the end date=2010-09-01 which changes the meaning
of the two fields.Can anybody suggest me a way to show a error
message while this is done.
with regards
Soumya
Reply | Threaded
Open this post in threaded view
|

Re: want to know if any validation exists

pankaj savita
Hi Soumya,

   You can do validation in your simple method by using condition like:

               <condition>
                    <or>
                        <and>
                            <not><if-empty
field="parameters.thruDate"/></not>
                            <if-compare-field operator="less"
field="timeEntry.fromDate" to-field="parameters.thruDate"/>
                        </and>
                        <if-empty field="parameters.thruDate"/>
                    </or>
                </condition>

     Refer
ofbiz10.04\applications\workeffort\script\org\ofbiz\workeffort\timesheet\TimesheetServices.xml


--
Thanks & Regards,
Pankaj Savita
Mob: +91 9890262476
Mail to: [hidden email]


On Fri, Oct 1, 2010 at 5:01 PM, soumya jyoti guru <[hidden email]>wrote:

> Hi all,
>        I  am facing a problem while validating two dates used in the
> same form (start date, end date).I have written a code
> for create and there I had included two fields named as start date and
> end date.
>       The problem is that the data gets created even if the start
> date=2010-09-30 and the end date=2010-09-01 which changes the meaning
> of the two fields.Can anybody suggest me a way to show a error
> message while this is done.
> with regards
> Soumya
>
Reply | Threaded
Open this post in threaded view
|

Re: want to know if any validation exists

Ankit Jain-3
In reply to this post by soumya jyoti guru
  Hello Soumya,

You can handle it by two ways :

1) Add a check in the service if the End Date is greater then Start Date
then throw an error message.

2) You can also handle it by JavaScript, if the dates are not correct
and restrict user to submit.  I had updated a patch which is doing
something like this, you can refer it.

https://issues.apache.org/jira/browse/OFBIZ-3161

--
Thanks&  Regards:
Ankit Jain
Enterprise Software Developer
Hotwax Media Pvt. Ltd.
www.hotwaxmedia.com


On Friday 01 October 2010 05:01 PM, soumya jyoti guru wrote:

> Hi all,
>          I  am facing a problem while validating two dates used in the
> same form (start date, end date).I have written a code
> for create and there I had included two fields named as start date and
> end date.
>         The problem is that the data gets created even if the start
> date=2010-09-30 and the end date=2010-09-01 which changes the meaning
> of the two fields.Can anybody suggest me a way to show a error
> message while this is done.
> with regards
> Soumya