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

  • SEARCH
  • Home
  • 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 6928949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:15:20+00:00 2026-05-27T11:15:20+00:00

I have a large Ruby on Rails form that has the following partial view

  • 0

I have a large Ruby on Rails form that has the following partial view structure (file _form.html.erb)

<script language="javascript" type="text/javascript">

    function myFunction1() {

        ... some js code here

    }

    function applyConfigs() {

        ... some js code here

    }

</script>

<%= form_for(@test, :html => {:name => "Test", :id => "test_form"}) do |f| %>

    ... some Ruby code here

    <div class="actions">
        <input type=button value="Run Function1" onclick="myFunction1();">
    </div>

    ... some Ruby code here

    <div class="actions">
        <input type=submit value="Apply" onclick="applyConfigs();">
    </div>

<% end %>

In this situation, none of the functions gets called when I click “Run Function1” or “Apply” buttons (the buttons highlight but do nothing). But if I put each function in a separate

<script>
</script>

therefore having 2 script /script sections containing one function each, then function myFunction1() gets executed properly but applyConfigs() still does not (the form is submitted but applyConfigs() function is not executed). There are no error messages in any case, just the functions not executed.

Any idea what’s going on here?

My function applyConfigs() is quite large but here’s my other function that I called myFunction1()

function showHideDiv(elementId,buttonId) {
    if (document.getElementById) {
        var element = document.getElementById(elementId);
        var button = document.getElementById(buttonId);
        if (element.style.display == 'none') {
            element.style.display = 'block';
            button.value = "Hide Options";
            return false;
        } else if (element.style.display == 'block') {
            element.style.display = 'none';
            button.value = "Show Options";
            return false;
        }
    }
}
  • 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-05-27T11:15:21+00:00Added an answer on May 27, 2026 at 11:15 am

    The input type submit will submit the form. You need to change it:

    <div class="actions">
     <input type="button" value="Apply" onclick="applyConfigs();">
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails app that processes a large (millions) number of records in
I have a ruby 1.9 rails 3.0.7 application that is using lucid/solr to index
I'm working on a ruby on rails app that generates a large XML document
I have a Rails 2.3.8 app with an action that pulls a large amount
I have large batches of XHTML files that are manually updated. During the review
I'm developing a website in PHP and I have large JS files that I
I have a large codebase that targetted Flash 7, with a lot of AS2
I've got a fancy-schmancy worksheet style view in a Rails app that is taking
I have the Ruby on Rails-based application Redmine (based on the BitNami redmine package)
Given a really large, 3+ gig, binary file is there anyway that I could

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.