Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9153715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:19:04+00:00 2026-06-17T12:19:04+00:00

I have a Rails app with a Bootstrap modal. Here is part of the

  • 0

I have a Rails app with a Bootstrap modal.

Here is part of the code that launches the modal:

  <a type="button" class="btn" href="#labor_modal" data-toggle="modal" data-woid= <%= workorder.id %>><i class="icon-time"></i></a>

Here’s part of the code for the modal:

<div class="modal fade" id="labor_modal">
  <div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
  <h3>Add Labor</h3>
  </div>
  <div class="modal-body">
    <%= simple_form_for(Event.new, validate: true, remote: true, html: {"data-type" => :json}) do |f| %>
    <%= f.hidden_field :workorder_id, :value => data-woid.val() %>

I want to get the work order.id passed to the modal so it can be saved in the new record.

This code isn’t working:

<%= f.hidden_field :workorder_id, :value => data-woid.val()

Any help would be appreciated !!

PS – I was hoping I could do this without jquery – but, if I need it so be it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:19:05+00:00Added an answer on June 17, 2026 at 12:19 pm

    <%= %> is an ERb (embedded Ruby) tag. Inside should be Ruby code.

    data-woid.val() 
    

    is not valid Ruby in the context which you use it.

    ERb is processed before rendering HTML. At the time ERb is processed, Ruby is not aware of the DOM or rendered HTML elements or their attributes. There is no way to read HTML data attributes in Ruby via ERb. You must access them after the page is rendered and the DOM is built. Use JavaScript/jQuery for this.

    I’m guessing that work_order.id will be used to set an association. Exposing this to the user is insecure; it is possible to change the value to anything before submitting. Associations should be set in the controller, specifically the create action before you call save.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using http://twitter.github.com/bootstrap/javascript.html#tooltips on a app. I have this rails code: <%= link_to t('.shipping_details'),
I have a Rails 3.2.5 app that is using Twitter Bootstrap. I am trying
I have a Rails app that is served by Apache and Passenger, using only
I have a Rails app that does everything I need it to do via
I have a rails app that is combining javascript assets using Jammit , and
I have a Rails app that is running on port 8080 that I need
I have a Rails 3 app that I'm looking to create in-house analytics for.
I have a rails app that is working fine except for one thing. When
I feel so noob to ask this. Now, I have rails app that is
I have a rails app that has an jquery ui autocomplete search input. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.