Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
redraw/redrawLabels not working
System
I have noticed that if I have code such as the following:
IWDatacapture.gotoPage( 1 );
IWDatacapture.getItem( "/field" ).setFocus();
IWDatacapture.getItem( "/field" ).setValid( false );
IWDatacapture.setHighlightMode( true );
IWDatacapture.redrawLabels();
Whether the last line is redraw or redrawLabels, sometimes the form does not redraw correctly. If I use the following instead, it seems to work.
setTimeout( "IWDatacapture.redrawLabels();", 200 );
I am not sure what the cause is but I thought someone else might find this useful.
Find more posts tagged with
Comments
Migrateduser
I think there is another twist here.
Even if the user changes the value in the invalid item, TeamSite disallows save until I explicitly setValid to true. I am not sure if that is a bug or a feature, but since the same validation is done the next time the form is saved I add:
IWDatacapture.gotoPage( 1 );
IWDatacapture.getItem( "/field" ).setFocus();
IWDatacapture.getItem( "/field" ).setValid( false );
IWDatacapture.setHighlightMode( true );
setTimeout( "IWDatacapture.redrawLabels();", 200 );
setTimeout( "IWDatacapture.getItem( '/field' ).setValid( true );", 300 );
syim
Thanks for sharing your solutions. It helps me to figure out how to reset those invalid items.
Instead of using setTimeout() function, I created onItemChange handler. In the function for the onItemChange event, setValid(true) is called to reset those invalid items. Those invalid items will not get reset until the value is changed. For example:
IWEventRegistry.addItemHandler("/field", "onItemChange", resetValid);
function resetValid(item)
{
item.setValid(true);
}
AddToCollection.ppt