Trigger a button from another button element

Hi,
I would like to have some advices on how to trigger a radio button after an onclick on another button.

Let say, I have this form that has a field to upload an image to the dataset but before doing so, I would like to offer the user to decline Yes or No the upload. This would still make the upload button mandatory and give a second choice to decline.

Any suggestions on how to do this would be really appreciated.

Thank you

Pierre Lacasse

Hello Pierre,

To do this you would have to have the initial button only to show the ‘yes/no’ dialogue box/buttons.
The ‘yes/no’ dialogue will be the actual submit, where yes will submit and no will hide the ‘yes/no’ dialogue box.

Best,
Majd

Thank you for your reply.

Actually, I have this form that has several inputboxes and this upload file button.

All my inputboxes are mandatory to fill but not the upload image button.

This works but people tend not to click the upload button. I do not want to make this upload mandatory but want to at least force people to make making the decision.

So what I thought is to have this Yes/No button mandatory and on the result either upload or not the image file.

I think I know how to make the Yes/No button mandatory but it is the redirecting to upload that I have difficulties with.

Would you have some clues on how it could be coded?

Thank you any help is much appreciated

Pierre Lacasse

Hi Pierre:

You could create a drop down for the upload image.
The placeholder would tell the user to make a choice - “Do you want to upload an image?”
The options would be “Yes” or “No”.

Then check that there is a selectedIndex on this element ($w(‘#dropdown’).selectedIndex >= 0) which will tell you that the user made a decision.

Then you can set an onChange() handler for the dropdown and check what the user selected. If the user selected yes then you could show (or enable) the upload button to allow the upload to happen. You could verify that the decision was made AND if the upload occured if yes was selected as an additional check.

Hope this makes sense. If you need help with some example code just ask :wink:

Steve

Hi Steve,
yes it does make sense.

So by making the dropdown mandatory, I then force them to make a decision.

If you could provide some example code, that would been greatly appreciated.

Pierre Lacasse

Hi Pierre:

Take a look at this page it should help you out.

https://stcroppe.wixsite.com/steveonsoftware/wix-dropdown

Steve

Steve,
thank you so much for the example.

I managed to do something with my code, dropdown button and it works.

Pierre

1 Like

Good to know. Can you mark the post above as a top comment? It will help others out.
Cheers

1 Like