Play a sound when submit is pressed

Can anyone help with a way to play a sound via the speakers when a submit is pressed with a certain result ticked on a form?

thanks

Andrew Steele (UK)

Thanks for the advice Sunny, We'll have a look at that method :)

Ā 

HelloĀ Andrew,

Ā 

Yes possible using JavaScript.Ā 

for example upload a mp3 or other format file in knackĀ get it url. Using jQuery you can run sound file when Submit button is pressed or any event when you want.Ā 

Ā 

Regards,

Sunny Singla

ssingla1985@gmail.com

+919855089359

Sunny, is it possible for you to tell me how to upload a url into Knack?

I would like to do something similar in the following, but canā€™t figure out how you did it:

https://roberts.knack.com/farmers#test-sound/

Any additional help is appreciatedā€¦ JON

$(document).on(ā€˜knack-form-submit.view_82ā€™, function (event, view, data) { // Login Page to Redirect
var audio = new Audio(ā€œhttps://cdn.pixabay.com/download/audio/2022/03/16/audio_492840191c.mp3ā€);
audio.play();
});

1 Like

Thank you Sunny as always.

I have created an object with two fields (name, file) where I can import a sound file that I have or downloaded. My question is, how to I found out the URL of this file after I import and save it into my Knack database so that I can place it in the link of the code you provided?

Here is an example of a audio file that I would like to played when user presses ā€œsubmitā€

When I replace the above link into the code you provided, nothing happens. I even downloaded the file and imported it into my Knack program hoping that I could get the URL where Knack stored it.

Hello Jon,

You need to see that values in a network folder. Also, you can add that object in view and user Knack.view.data to see itā€™s url.

Thanks,
Sunny Singla

I appreciate the help Sunny, but for some reason I canā€™t get the below file or any file to work other than the one in your example.

Thanks againā€¦ JON

thatā€™s strange.

can you share your file i try to upload and share itā€™s url

I just sent you an email with example app.