Code Monkey home page Code Monkey logo

link_to_remote_with_prompt's Introduction

LinkToRemoteWithPrompt
======================

Inspired by Russ Sherman's work on link_to_with_prompt.
(Russ Sherman "code-ronin" - original author of link_to_with_prompt [http://acts-as-coder.blogspot.com/])

link_to_remote now accepts a :prompt option

canceled prompt = no AJAX call
'ok' with blank text field = no AJAX call
'ok' with something in text field = AJAX call, along with your_var_name assigned whatever was typed in the text field.
* text field is named prompt_reply, but the value will show up as params[:your_var_name]

View Example
============

<%= link_to_remote "link_name", { :url  => { :controller => 'your_controller', 
                                             :action => 'your_ajax_action', 
                                             :id => whatever_object_here,
                                             :some_other_param => "whatever" }, 
                                  :method => :put,
                                  :prompt => "Message to user here with #{some_instance_variable_if_you_please_in_here}\nWith another line of text here.",
                                  :with => "'your_var_name=' + (prompt_reply)",
                                  :html =>  { :class => "some_class_here" }} %>




Don't forget to add the AJAX action to your restful routes:
======================================================
map resources :plural_model_name, :member => { :your_ajax_action => :put }








Copyright (c) 2009 [Randy Walker], released under the MIT license

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.