cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pjwilson1987
Helper I
Helper I

Run Javascript Function - Input Text

I am trying to run the Javascript function on this website to input text in a field. However, it just writes over the placeholder text and does not recognize the text when clicking the search button after.

I want to add text in the input field and then click the search button with javascript (only clicking the search button works).

 

The 'Populate Text Field on Web Page' action works to input the text, but the javascript function to input text does not.

I am using same code from PAD documentation (Populate Text Fields and Click on Links Using JavaScript).

Any reason why I am unable to use the Javascript function on the web page to input text?

 

PAD Flow:  https://power.automate.gallery/y9LhBZJnPmT3

1 ACCEPTED SOLUTION

Accepted Solutions
PAG
Resolver I
Resolver I

Hello @pjwilson1987 

 

The search box needs triggers to work. Those are automatically launched when used "Populate Text Field on Web Page" action, but not with JavaScript. These are the missing triggers:

$('#sidebarSearchbox__2192').val('jacksonville').trigger('keydown').trigger('change');

 

Complete solution:

https://power.automate.gallery/puwTrWH51Amf 

View solution in original post

2 REPLIES 2
PAG
Resolver I
Resolver I

Hello @pjwilson1987 

 

The search box needs triggers to work. Those are automatically launched when used "Populate Text Field on Web Page" action, but not with JavaScript. These are the missing triggers:

$('#sidebarSearchbox__2192').val('jacksonville').trigger('keydown').trigger('change');

 

Complete solution:

https://power.automate.gallery/puwTrWH51Amf 

pjwilson1987
Helper I
Helper I

I was not aware of the triggers part. This makes sense now and works perfectly.

Thanks @PAG!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Top Kudoed Authors
Users online (4,366)