Page 1 of 1

Trimming String Fields?

PostPosted: 09 Mar 2014 23:30
by Aggie85
Howdy!

I tried implementing an OnAsyncExit event to implement trimming of the field text, but it has negative side effects on my pages (i.e. caused some regions to not draw right after my first control exits).

So my question is how can I implement a simple ajax routine to strip any blanks on an edit field after the users tabs out?

My OnAsyncExit routine was written as follows:

void __fastcall TIWAppFormActionsDataModule::OnDBEditAsyncExit(TObject *Sender, TStringList *EventParams)
{
TIWEdit * pEdit = dynamic_cast<TIWEdit *> (Sender);
if (pEdit == NULL)
{
return;
}

pEdit->Text = pEdit->Text.Trim();
}

Thanks in advance,

Aggie85

Re: Trimming String Fields?

PostPosted: 10 Mar 2014 10:13
by Aggie85
Just an update!

I still would like a javascript solution for real-time visual effects, but for now I have just added a generic OnSetText event to my string fields within my edit data sets!

Thanks,

Aggie85

Re: Trimming String Fields?

PostPosted: 10 Mar 2014 10:43
by Jorge Sousa
Hi

I tried implementing an OnAsyncExit event to implement trimming of the field text, but it has negative side effects on my pages (i.e. caused some regions to not draw right after my first control exits).


This is very strange! Why should a simple andcorrectly implemented event handler would cause some regions to not draw right?

But the Field.OnSetText or DataSet.BeforePost would be just fine.

Re: Trimming String Fields?

PostPosted: 10 Mar 2014 10:52
by Aggie85
cgdevtools_support wrote:Hi

I tried implementing an OnAsyncExit event to implement trimming of the field text, but it has negative side effects on my pages (i.e. caused some regions to not draw right after my first control exits).


This is very strange! Why should a simple andcorrectly implemented event handler would cause some regions to not draw right?

But the Field.OnSetText or DataSet.BeforePost would be just fine.


Many of my pages have client side resizing (i.e. TIWURLWindows that auto-height, grids that use OnAdjustedHeightToRows. The pages are rendered correctly the first time but after the first OnAsyncExit() event is fired, many pages to to HECK!! It is probably an IW effect, but I can live with the OnSetText() method though it isn't visual until AFTER a submit is done!

Thanks again!

Aggie85