Ticket #274 (defect)

Opened 2 years ago

Last modified 3 months ago

TDatePicker 'Textbox' InputMode & incorrect user input die in TInvalidDataValueException Pattern mismatch

Status: reopened

Reported by: zecat Assigned to: wei
Priority: normal Milestone: 3.0.4
Component: Prado Framework v3 Version: 3.0
Severity: minor Keywords:
Cc:

Some incorrect input from user in a TDatePicker 'Textbox' inputMode with validator (or without) produce a TInvalidDataValueException Pattern mismatch.

Sample code to reproduce error :

	<com:TDatePicker ID="MyDate" 
		DateFormat="dd/MM/yyyy" 
		Mode="ImageButton" />
	<com:TRequiredFieldValidator 
		ControlToValidate="MyDate"
		ErrorMessage="date required (dd/MM/yyyy)" />
		
	<com:TDataTypeValidator
		DataType="Date"
		DateFormat="dd/MM/yyyy"
		ControlToValidate="MyDate"
		ErrorMessage="date must be of the form dd/MM/yyyy" />

	<com:TButton Text="Submit!" OnClick="button1_clicked"/>
	
	<com:TLabel ID="label1" />
	public function onLoad($param)
	{
		if(!$this->IsPostBack)
			$this->MyDate->TimeStamp=1152918600; //timestamp comes from outside;
	}
	
	function button1_clicked()
	{
		$this->label1->Text = $this->MyDate->TimeStamp;
	}

With this sample code, if the user put '05/07/2006ttt' in the Tdatepicker textbox, I get following error :

TInvalidDataValueException Description Pattern 'dd/MM/yyyy' mismatch

../..

Trace de la pile d'exécution: #0 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\WebControls\TDatePicker.php(520): TSimpleDateFormatter->parse('05/07/2006ttt') #1 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\WebControls\TDatePicker.php(250): TDatePicker->getTimeStampFromText() #2 C:\INTRANET\www\prado-3.0.2.r1226\framework\TComponent.php(102): TDatePicker->getTimeStamp() #3 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\TControl.php(196): TComponent->get('TimeStamp') #4 C:\INTRANET\www\prado-3.0.2.r1226\feeds\protected\Pages\Posts\EditPost?.php(89): TControl->get('TimeStamp') #5 C:\INTRANET\www\prado-3.0.2.r1226\framework\TComponent.php(364): EditPost->saveButtonClicked(Object(TLinkButton), NULL) #6 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\WebControls\TLinkButton.php(232): TComponent->raiseEvent('OnClick', Object(TLinkButton), NULL) #7 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\WebControls\TLinkButton.php(219): TLinkButton->onClick(NULL) #8 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\TPage.php(712): TLinkButton->raisePostBackEvent('undefined') #9 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\TPage.php(235): TPage->raisePostBackEvent() #10 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\UI\TPage.php(170): TPage->processPostBackRequest(Object(THtmlWriter)) #11 C:\INTRANET\www\prado-3.0.2.r1226\framework\Web\Services\TPageService.php(458): TPage->run(Object(THtmlWriter)) #12 C:\INTRANET\www\prado-3.0.2.r1226\framework\TApplication.php(988): TPageService->run() #13 C:\INTRANET\www\prado-3.0.2.r1226\framework\TApplication.php(346): TApplication->runService() #14 C:\INTRANET\www\prado-3.0.2.r1226\feeds\index.php(23): TApplication->run() #15 {main}

Thank you.

Change History

07/07/2006 09:04:03 PM: Modified by xue

  • owner changed from xue to wei.
  • milestone set to 3.0.3.

08/04/2006 07:39:00 PM: Modified by wei

  • status changed from new to closed.
  • resolution set to fixed.

08/29/2006 08:40:52 AM: Modified by wei

  • status changed from closed to reopened.
  • resolution deleted.

08/29/2006 08:42:12 AM: Modified by wei

  • status changed from reopened to closed.
  • resolution set to fixed.

08/30/2006 07:31:45 AM: Modified by xue

  • status changed from closed to reopened.
  • resolution deleted.
  • milestone changed from 3.0.3 to 3.0.4.

problem seems still there (on both 3.0 branch and trunk)

08/30/2006 08:11:36 PM: Modified by wei

  • status changed from reopened to closed.
  • resolution set to fixed.

04/28/2008 06:19:48 PM: Modified by thomasz

  • status changed from closed to reopened.
  • resolution deleted.

This bug is still there! With disabled client side validation I get a TInvalidDataValueException after entering for example "10.10.2008abc":

<com:TForm>
	<com:TDatePicker ID="dpDate" DateFormat="dd.MM.yyyy" FromYear="2007" Columns="10" />
	<com:TButton ID="btnSubmit" Text="Submit" OnClick="btnSubmitClicked" />
	<com:TDataTypeValidator ID="valDate" EnableClientScript="false" ControlToValidate="dpDate" DataType="Date" DateFormat="dd.MM.yyyy" ErrorMessage="Enter valid date!" />
</com:TForm>

TSimpleDateFormatter->parse('10.10.2008abc') throws the exception instead of returning null to the validator. If you enter for example "10.10.2abc" server side validation works.