I'm still very new to rails so forgive me if this question just doesn't make any sense. However, I have a requirement to update several dropdown boxes in a report (which has one dropdown per row) at the same time. So, instead of clicking each dropdown in each row and selecting the status, what the user would like to do is press a button (or some other action) that changes all rows to a particular status. This functionality would be similar to selecting several checkboxes next to unread emails in gmail and hitting the "mark as read" button.
Any and all help appreciated.
This should help get you started:
http://railscasts.com/episodes/165-edit-multiple
http://railscasts.com/episodes/52-update-through-checkboxes
Related
I am trying to work on a google sheet where one Tab will be an entry form and another will be a database. I need the form to be used by multiple users. Currently the Form tab displays all changes to other users so multiple users cannot use it at the same time.
Is there a way to allow 1 user to see their own entries and a 2nd user to see different entries. When they press my button it should record their individual entries on the database tab.
I cannot use Google Forms for this project due to the complexity of the form and the need for cascading drop-down lists and dynamically available information on the form.
Thanks
After researching extensively, the answer to my question is that there does not seem to be a good way of doing this.
My final approach was to create a tab for each user with the calculations, cascading dropdowns, and buttons/scripts that affected their specific sheet and recorded data on the database tab based on their specific sheet.
Hopefully, this helps the next guy who is searching for this answer. If anyone has found a way to solve this, let me know so I can test and give you credit for solving what I could not.
I am working on a Grails project, its an accounting project. We have multiple clients and they can have multiple types of accounts. I have to create the 'create' page for client, there should be a way to add multiple types of account to the client.
So I was thinking of making a drop-down list with account types and few text boxes to enter account name and other info about account. Also, as a client can have multiple accounts, so I want to create a 'add' button, when clicked it would display a new row to add a new client. I have done this kind of UI before using javascript but in this case, as there is a drop-down list and other components, I think it would be very hard and may not work.
I was thinking of creating a partial view which would render each time user clicked the 'add' button with additional row, problem with this would be during validation errors, edit page and i would also have to pass all values each time user clicks 'add' button.
Is there any other for doing this?
For the template approach you must use ajax if you don't want to carry on the params that the user has already set.
It is possible to make new drop-down lists appear (or any group of elements inside a <div>) when a user clicks a button, since Grails already comes with jQuery you might want to take a look at the .clone() method.
The problem with the two listed approeaches is that it will be possible to have duplicates.
Now, another option is to use checkboxes, so you can check just the type of account you want.
But to be honest it does seems a bit odd or even inapropiate to let the user choose the type of account he wants with such freedom.
I'm using ASP.NET MVC 3.
I have a long list of items and I'd like to display them to the user with a checkbox next to each item representing whether the item is on or off. Because there are many items, the items are display using paging.
When a page is loaded, a checkbox is checked if the item is on. The user can page through the items, check/uncheck the checkboxes.
I want to enable the submit button only when there is a change of the items' states. What is the optimal way to detect if the list of items is in dirty state when the user pages through the list and makes changes.
How you would do this is different depending on if you are doing page refreshes for scrolling or ajax.
If you are just reloading the page with the new page information, then you will need some kind of state to keep track of the previously selected items. This could be done either in Session, or in a temporary table. A temporary table would survive a session reset, and would work in a server farm scenario.
In any event, either your page postsback on checkbox click, or you post on next page (In either case you want to do a post-redirect-get pattern). When the page refreshes, you need to return an indication of whether the collection is dirty or not, and enable the submit button.
Be aware that a user could walk away in mid-selection and come back half an hour later or something. If their login is still valid, and you use session, session may have recycled.
If you're doing Ajax, then you need to keep a running list of changes, so that if the user later unselects them you can disable the submit button again. You would keep this list in a hidden field, and either ajax post each checkbox as it happens to a temporary table, or you could just keep the running total in the hidden and apply the changes when submit is called. Your hidden field would probably contain a list of id's that you have changed (either checked or unchecked). And when the field is empty, disable the button and when it's not, enable it.
I have googled for 2days so far :) Not finding the right answer yet. So expert help is needed.
I am writing the webpage, where I use php and mysql. On the webpage, it display list of products. Next to each product there is a button called "Compare". When user press the button, it should pop up the dialog box and ask user to enter some info then user click submit or cancel in the dialog box. When user click submit in the dialog box, it should take user to another page, where he will be displayed with information he is looking for (hopefully)....
For dialog box I am using jQuery-ui dialog box. The challenge I am facing is when user click on "Compare" button, I need to pass the product information to dialog box. Because all the product info are extracted from mysql and loop with php to display, they all have same class. eg
product 1Compare
product 2Compare
So how do i know which product_info i need to pass? I thought of adding attribute to button and product info with number to distinguish which one is selected, then i need to have multiple multiple dialog function attached to each button.
Any thought will be much appriciated.
Thanks
Create a global variable to store the index.
When we click on any button, we will check it's index and store in it.
After opening the popup or just before showing the popup, access this index. Using this index, access the division in which the product contains. Get required details from there. Update data in dialog box. Show dialog box.
Also clear global variable when you close the dialog box.
You can get more information about index here : http://api.jquery.com/index/
Friends, please suggest better solutions if any.
Thanks.
For a case where I have models like:
Coutries
States
Cities
Opinions
I'd like to begin with just presenting a user with a dropdown for Coutries.
Once a country is selected, then a States dropdown would appear below Countries.
Once a State is selected, then a Cities dropdown would appear below States.
Once a City is selected, a textboxt appears and the user writes their opinion of the city.
Once text is placed in the textbox, a 'submit' button appears.
Once the user clicks 'submit' I process the form data.
I'd like to populate each dropdown from a corresponding table using the previous selection to limit the dropdown items.
I'd like the same sort of functionality with checkboxes too.
Basically, I'd like to be able to define a cascading form input scheme. I have seen some information on the topic, but nothing that wraps it up tight for Rails 3. For instance:
Rails 3.1 Dependent / Cascading Dropdowns and
Rails 3.1 interdependent select dropdown lists
... seem to offer only partial solutions. I am getting the feeling that I might be missing some fundamental Rails concept and that this (seemingly common) task should be easier. I want to streamline the user input experience. My models have a lot of good default data that I'd like to present to the user as they make their input choices. I just can't seem to get it all on one page.
I don't get the search results I am seeking when I look for "Rails dynamic form input" Searching for "Rails Cascading dropdown" has helped some. "Rails active form" gets me a piece of internet history.
Can someone guide the way?
Thanks!
ADDENDUM
This seems to allude to the trouble I have stumbled upon: http://guides.rubyonrails.org/form_helpers.html#building-complex-forms Perhaps that's my answer?
JQuery is the way to go here I think. Now I am no expert in matters pertaining to JQuery, but I hope I can at least point you in the right direction. To accomplish your cascading list, you could show and hide the select inputs based on the change of the previous one. From there I would look into a JQuery library called jquery-chained. This library would allow you to show in the states select only those states which pertain to the selected country. I do have a couple working examples of the chained library that I could show an example of if you would like, and I am sure there are many examples out there of hiding and showing form elements in JQuery.