简体   繁体   中英

how to disable a link_to with condition, using slim in ruby ​on rails

I'm new to slim and ruby ​​on rails and trying to figure out how to disable a link_to if the condition isn't required.

f.actions do
      = f.submit 'save data'
      = link_to 'send data'

Here f, is a form that the user fills, and when the form condition is not met, that means submit asks user to fill some required field, I want link_to "send data" to be disabled How can I do that guys?

Rails include multiple link_to helpers to display a link if a specific condition is met.

link_to_if

https://apidock.com/rails/v5.2.3/ActionView/Helpers/UrlHelper/link_to_if

link_to_unless

https://apidock.com/rails/v5.2.3/ActionView/Helpers/UrlHelper/link_to_unless

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM