Skip to Content
author's profile photo Former Member
Former Member

Date InputField Set

Hi experts,

i've read a lot of threads in the forum but i've haven't found any answers to my question.

here is the code of my wdInit method in my StartView:

  public void wdDoInit()
  {
    //@@begin wdDoInit()
    String date_deb_init = new String("01/01/1900");
	String date_fin_inti = new String("31/12/9999");
	SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
	
	try {
			wdContext.currentContextElement().setValDate_start(
				(java.sql.Date) sdf.parse(date_deb_init));

			wdContext.currentContextElement().setValDate_end(
				(java.sql.Date) sdf.parse(date_fin_inti));
	} catch (Exception e) {
		wdContext.currentContextElement().setAffichage(e.getMessage());
	}
    //@@end
  }

but, after execution, the 2 inputfields are still empty.

I don't under stand why it don't pass in the

try

block ...

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 10:51 AM

    hi,

    use this code

    java.util.Date tempDate = Calendar.getInstance().getTime();
    		Date sqlDate = new Date(tempDate.getTime());
    
    		wdContext.currentContextElement().setDate1(sqlDate);

    where Date1 is the value attribute. This code will set the Date attribute with the current date.

    Regards,

    Gopi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 02:46 PM

    Hi ,

    try this.

    long time = System.currentTimeMillis();

    java.sql.Date dt = new java.sql.Date(time);

    wdContext.currentContextElement().setOne(dt);

    Here one value attribute should be date .

    Thanks,

    Lohi.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2007 at 01:35 PM

    hi,

    Go thru this link

    reg-assigning-a-date-value-in-context

    U might solve your problem.

    Thanks,

    Lohi.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.