How to show number_field after clicking radio_button - ruby-on-rails

Hi i'm new to rails and i would like tohave number_field to show out after the user clicked the radio_button. For example, i have 3 radio_buttons. If the user clicked the 2nd one, it'll then show a number field to ask the user to enter some data required and later on pass to a function defined in controller after user click submit button.

Related

How to skip html5 validations when clicking on SKIP button

I have button SUBMIT and SKIP on same page.When user click on submit all validation check and form submit that's good .
Issue is with SKIP button. How I skip validations when user click on SKIP button?
Write javascript/jquery code to remove the required attribute from the relevant fields on clicking the skip button.
In your view you want to create a reset type button, assuming you're using form_for or something that provides a local f var:
= f.button "Skip", type: :reset
Then in a javascript file that's loaded you want to attach to the click event for that button, I've written this in coffeescript (and accounting for turbolinks):
$(document).on "ready page:load", ->
$("button[type=reset]").click ->
form = $(#).closest("form")[0]
form.reset()
form.submit()
This will cause that button to both reset the form (ie. clear any values in it) and submit the form.
If JS is not enabled then the button will act like a standard HTML "reset" button (without submitting the form.

Validate Forms step by step

I want to use ASP.NET MVC to create a registration page.
The registration page will have a single view and it will have multiple forms. The user can use "back" and "continue" buttons to go to a form (partial form).
First step:
On Form1, the user will enter his name, email and click "continue" which should do a postback and validate the form inputs. If form is valid, display form 2.
Second Step:
The user will add his company address and then click on "Done".
How can I create such a form in multiple steps?
I want to use ASP.NET MVC to create a registration page. The registration page will has a single URL and it will have many forms. The user can use "back" and "continue" buttons to go to a form (partial form).
FIRST STEP: The user will enter his name, email, .. in Form1 Then he should click on "continue"--> Postback and validation of inputs. SECONED STEP: If Form1 is OK and the user has clicked the "continue"-button the second form (Form2) will appear. The user will add his company address and then click on "Done".
How can I create such a form in multiple steps?

How can I embed a form (scaffold) into a home page using ROR?

I have created a scaffold called TRADER and gave it the entries
fname:string
lname:string
twitteruser:string
email:string
I want the form visible on the index page for the app user to submit their entry. Upon submission, I want a pop up box to appear saying " Thank you for your submission."
I do not want to show the user what they just submitted, and the DB that holds all the submissions is accessed with authentication only available to me.
Currently the blank form is located in localhost:3000/traders/new
then after submission, the app displays the submitted information.
First, How can I embed the form into the index page ?
Embedding your form
In your index.html.erb, add the following line:
<%= render 'form' %>
Assuming that the form partial is stored under app/view/trader with a name _form.html.erb.
Redirect
In your traders_controller.rb, edit the create action so that the user is not redirected to what the entry they submitted. I assume that there is a line like redirect_to #trader upon a successful save on the database. Instead, use something like redirect_to root_path, or wherever you want the users redirected to.
Pop-up box
In your traders.js.coffee under app/assets/javascripts, add some codes to display alert box on a successful submission of the form. Something like:
$("#your_form").submit(function(event) {
alert("Thank you for your submission.");
});

Display content of database in a form in struts2

Display content of database in a form with textfields in struts2.
Here is a senario. It's just an example.There is a jsp page (abc.jsp) which shows list of employees. This page contains a button (Add employee), when user clicks this button an action abcAction is called which opens xyz.jsp asking user to fill necessary information like emp_ID, emp_name, etc. On sucess abc.jsp page is opened showing the entered information on a table. Along with this informtaion an"edit" button is appeared on the same page(abc.jsp). Now how to display xyz.jsp page when user cicks edit button along with the necessary fields entered by the user based on emp_ID.

Custom Display Form with Custom Workflow button

I have created a new custom list form that will show 4 fields on the page from a Custom List called "Shipment". I have added Form Action button that I would like to run a custom action that is set inside of a Workflow. Currently, the form displays the fields for "Manifest Number", "Pickup Location", "Delivery Location", & "Scheduled Pickup Time". When the user clicks the Form Action button, what I want the Workflow to do is go to the ID field of the displayed content in the Form and change the value of the "Picked Up" column from No to Yes. The problem I am having is passing the ID of the displayed information from the Form to the Workflow as a variable. I can get the "Picked Up" column to update if I specify the value in the "Update List Item" window under the "Find the List Item" section, but I cannot figure out how to do this dynamically from the Form
You need to add a hidden field to store the ID in the custom list form. Copy the line that displays "Manifest Number" and change it to point to the ID field. And the change the variable name to ff6 or something like that (given you already only have 5 fields). Now when you open the custom action workflow in SPD the ID field should be available for your apply as a filter.
Hope this helps.

Resources