10000 Review all submit buttons to include both name and value attributes · Issue #1502 · aces/cbrain · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Review all submit buttons to include both name and value attributes #1502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
prioux opened this issue Apr 15, 2025 · 10 comments
Closed

Review all submit buttons to include both name and value attributes #1502

prioux opened this issue Apr 15, 2025 · 10 comments

Comments

@prioux
Copy link
Member
prioux commented Apr 15, 2025

For historical reasons, we still have a bunch of buttons that trigger actions where the actions makes a decision based on the button's visible label.

E.g.

  • the submit_tag() that can be found in app/view/signups/_signups_table.html.erb
  • the external_submit_button found in app/view/background_activities/_background_activity_table.html.erb

This doesn't work well when people use browser extensions that translate the content of our pages, because the translated buttons now send the wrong values.

We can fix this quite simply by reviewing all these buttons and adding both a name and a value attribute to the tags (or maybe just value if the name is the default 'commit').

I already verified that external_submit_button() supports them both.

@prioux
Copy link
Member Author
prioux commented Apr 15, 2025

Actually, I'm no longer sure it works for external_submit_button()

@prioux
Copy link
Member Author
prioux commented Apr 15, 2025

So the HTML specs says the label is always the value for <input type="submit"> ; to do what I want we need to change the element to an actual <button>

@prioux
Copy link
Member Author
prioux commented Apr 15, 2025

This patch seems to do the trick and leaves everything else working as it were:

diff --git a/BrainPortal/app/helpers/dynamic_form_helper.rb b/BrainPortal/app/helpers/dynamic_form_helper.rb
index 238580ebe..50cf2958f 100644
--- a/BrainPortal/app/helpers/dynamic_form_helper.rb
+++ b/BrainPortal/app/helpers/dynamic_form_helper.rb
@@ -264,7 +264,7 @@ module DynamicFormHelper
 
     options["data-associated-form"] = form_id
 
-    submit_tag(name, options)
+    button_tag(name, options.merge(:form => form_id, :type => 'text'))
   end
 
   # Creates a disabled checkbox, which will be checked if

@prioux
Copy link
Member Author
prioux commented Apr 17, 2025

Work on this issue should wait until the PR for the new control channels if merged, because many buttons were already adjusted there.

#1501

@natacha-beck natacha-beck assigned natacha-beck an 8000 d prioux and unassigned natacha-beck May 26, 2025
@natacha-beck
Copy link
Contributor

Done by commit d3c8f45

@prioux
Copy link
Member Author
prioux commented May 26, 2025

I don't think it's done. There are still buttons to adjust.

@prioux prioux reopened this May 26, 2025
@prioux
Copy link
Member Author
prioux commented May 26, 2025

I think the only remaming page was in the Signups index page, which is admin only. I'll commit a change right now. It's simple, I tested it and it works.

@prioux
Copy link
Member Author
prioux commented May 26, 2025
8000

There is still one use in the neuro plugins. I will fix it there.

@prioux prioux closed this as completed May 26, 2025
@prioux
Copy link
Member Author
prioux commented May 26, 2025

For reference, the signups page fix is at 6b5b70e

@prioux
Copy link
Member Author
prioux commented May 26, 2025

Fixed in the neuro plugins too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0