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 8854099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:48:29+00:00 2026-06-14T13:48:29+00:00

Summary: When I try supplying a onsubmit or onreset callback to Jeditable, I get

  • 0

Summary: When I try supplying a onsubmit or onreset callback to Jeditable, I get Object [function] has no method 'apply' errors.

How I got here: I’ve been working on a rails plugin to supply Jeditable and jWYSIWYG for in-place WYSIWYG editing. Development is driven by a Rails project I’m working on which asks for specific functions.

One of the options I added was the ability to trigger Jeditable’s edit mode using a button instead of clicking on the editable text itself, following the pattern suggested in this answer. The next step, though, is to hide the button while in edit mode, and reveal it again when leaving edit mode.

The hide is easy enough; I just added a line to the triggering function which sends .toggle() to the button. Reveal is trickier. I figure I need to .toggle() again on submit or cancel, and helpfully, Jeditable offers onsubmit and onreset callbacks.

However, when I try using those callbacks, I get this Object [something] has no method 'apply' errors.

What I’m trying: Because this is in the context of a Rails helper, the actual mechanics are a little more involved than this, but the upshot is that I’m trying to follow this pattern, handing Jeditable this in the args:

"onsubmit":"showTrigger",

and then including this script:

function showTrigger(settings, original) {
    $(".edit_trigger[id='element_id']").toggle();
}

However, on submitting changes or canceling an edit, I get the error

Object showTrigger has no method 'apply'

…as described above.

I also tried sending in a function directly as the "onsubmit" argument (i.e. "onsubmit": "function(settings, original){$(\".edit_trigger[id='element_id']\").toggle();}" and then I just get Object function(settings, original){$(\".edit_trigger[id='element_id']\").toggle();} has no method 'apply' instead.

There must be something wrong with how I’m handing in this callback. Any ideas?

ETA: This answer suggests to me that somehow I’m providing a string to Jeditable when it expects a function instead. However, because I’m working within the context of a Rails helper, I’m not at all sure how to fix that – the "showTrigger" bit is set as a Ruby variable in the helper, and although window.showTrigger() is defined when the window is loaded, I don’t know how to designate that function within a Ruby variable such that it will be recognized as a function at page load time.

  • 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-14T13:48:31+00:00Added an answer on June 14, 2026 at 1:48 pm

    As my ETA above suggested, the problem did turn out to be passing a string rather than a function. My Rails helper was generating arguments for Jeditable by taking an argument hash and using .to_json. This made the string function name into, well, a quoted string. In order to provide this argument as a function name Jeditable would understand, I needed to include these specific arguments as a pre-JSON-ified argument.

    In other words, instead of defining a Ruby variable which contained a string with the name of the function, I defined it containing the JSON object with the name of the function. Instead of trigger_reset = 'showTrigger' I used trigger_reset = '{ onsave: showTrigger, onreset: showTrigger }'.

    Then, instead of including this as another argument in the args hash, where that hash was added to the args object in JS using $().extend(), I added the value of the trigger_reset variable as a third argument to extend().

    Of course, this turns out to all be bound up in code I didn’t include in my original question, so it’s no wonder nobody could help. Sorry, and thanks anyway.

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

Sidebar

Related Questions

I try to create a static function in Nop.Services.Customers.CustomerService for get customer list in
Summary When I try to run a JSF 2.0 application from within Eclipse (on
Summary : is there a way to get the unique lines from a file
Quick summary with what I now know I've got an EventWaitHandle that I created
When I try to add a SUMIF formula to an Excel file that has
I try to use this example to get images urls from http://www.nydailynews.com/cmlink/NYDN.Article.rss but no
I try to build a product with Tycho 0.13.0, but I get a following
This is the code I have. /// <summary> /// Method calls stored procedure and
In this example - http://jscience.org/api/javax/measure/package-summary.html , when I try to run in clojure, I
Summary: Can i get registry creation, modification, and last write times like i can

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.