How to detect only spaces in text field

I have a text field that is being used to update a database table. I only want to write when there is readable text entered.

How can I prevent the write if the text field has only “spaces”?

Try using python’s strip() method of strings, something like:if event.propertyName=='text': if len(event.newValue.strip()): system.db.runPrepUpdate(".....", [event.newValue])


The len() and strip() methods worked great!

My code

varChkDesc1 = event.source.parent.getComponent('Text Field 1').text
if len(varChkDesc1.strip(' '))== 0:
	varChkDesc1 = 'n/a'