Skip to main content
4-Participant
May 26, 2025
Solved

Focus on textfield

  • May 26, 2025
  • 1 reply
  • 491 views

Hello, i'm currently using ThingWorx 9.3.9-b1648 and I need to change the input focus from a textfield on a main Mashup to a textfield on a contained Mashup. I've tried searching for solutions but most relied on the AutoFocus and focusOnLoad attributes of the widget but they don't seem to be present in my version.

 

is there a way to change the focus of my textfields without those attributes?

 

Thanks in advance!

Best answer by slangley

Hi @FC_13279586 

 

You are correct that AutoFocus and focusOnLoad are not available in 9.3.9.  Here are some other possibilities:

 

JavaScript Approach: You can use JavaScript to programmatically set the focus on the desired text field. This can be done by adding a script to the main Mashup that targets the contained Mashup's text field. For example:

var containedTextField = document.getElementById('yourContainedTextFieldId'); if (containedTextField) {    containedTextField.focus(); }

 

Event Handling: Consider using event handlers to trigger the focus change. For instance, you can set up an event on the main Mashup that, when triggered (like a button click), will execute the JavaScript to focus on the text field in the contained Mashup.

 

Legacy Focus Options: Investigate any legacy focus options or other widget properties that might be available in your version. While specific attributes may not be present, there could be other ways to manipulate focus through custom scripts or event handling.

For further insights and documentation, you can refer to the following resources:

 

Regards.

 

--Sharon

1 reply

slangleyCommunity ManagerAnswer
Community Manager
May 27, 2025

Hi @FC_13279586 

 

You are correct that AutoFocus and focusOnLoad are not available in 9.3.9.  Here are some other possibilities:

 

JavaScript Approach: You can use JavaScript to programmatically set the focus on the desired text field. This can be done by adding a script to the main Mashup that targets the contained Mashup's text field. For example:

var containedTextField = document.getElementById('yourContainedTextFieldId'); if (containedTextField) {    containedTextField.focus(); }

 

Event Handling: Consider using event handlers to trigger the focus change. For instance, you can set up an event on the main Mashup that, when triggered (like a button click), will execute the JavaScript to focus on the text field in the contained Mashup.

 

Legacy Focus Options: Investigate any legacy focus options or other widget properties that might be available in your version. While specific attributes may not be present, there could be other ways to manipulate focus through custom scripts or event handling.

For further insights and documentation, you can refer to the following resources:

 

Regards.

 

--Sharon