I am using JSF2 with #ViewScoped
I have table listing, cliking on row opens record in disabled='true mode'
2- ON the popup in disabled view button called 'Edit'
3- When user clicks upon edit button, all fields on the form which are disabled will become enabled.
Problem is in disabled mode it is fine but when user clicks upon edit button it start displaying few values from old record which was being clicked.
It is not happening every time but randomly when you start clicking.
I am not reloading any data when user clicks upon edit button instead I only make ajax call and set attrib val to true and on the bases of that I render model values and it dispalys enabled values.
is it cache problem or any thing else ???
help required.
In your bean set enableStatus =0;
and in edit button and all of your text fields, set disabled="#{bean.enableStatus==0}"
when u will click on edit then set enableStatus = 1 in your action method and reRender it.
You will get what you want....
Related
I am new to ASP.Net MVC, and still trying to wrap my head around the controller and passing data to the view and back.
Here is my question. I have a model in my view with a property that is "isEnabled", which can be true or false.
I have an edit button, and an enable/disable button. Edit just takes me to a new view with a form.
I want the enable/disable button to change the property of the model to enabled or disabled.
Right now I have two separate buttons. When I click on them, it fires the appropriate action from the controller (EnableModel, DisableModel), and just reloads the current view.
How can I make it so, if the model is disabled the button shows and fires the enable action, and when it is enabled, the button shows and fires the disable action.
So here are the options I thought of.
1. Two buttons, I hide them as needed. I can use an if statement to check if the model is showing or not in razor.
2. Use javascript two to the above
3. Use javascript to physically change the button
What would be the best method?
Alright so looking back can't believe I ever even asked this haha.
I went the javascript route. I had a single button, and a simple onClick javascript class that would handle the toggling.
Vaadin loses the content on pressing the browser back button. If I have populated a table and if I go back to that page, the page is empty again. How can I save state of pages so that when I go back to them using browser back button they're in the state I left them.
I am using Navigator currently.
I am basically uploading an excel sheet using Upload component, and populating my table on the same page using table.additem(). I have a functionality that when user clicks on a row of the table, user navigates to the next page, but when I press the browser back button then the table is gone, and the upload shows no document selected.
The navigation updates Application/#!Main/ the variable part changes.
I just want my application to retain the state as it would do with a refresh.
I found the same issue. You should add scope #UIScope to your views, in this scope session works, and state will be saved.
I have a form fields in which I am displaying data.
The values should be disabled and edit button should appear, after clicking on Edit button, the values should be enabled and user can edit the data and only save button should appear
How to achieve these two requirements in a single form in Asp.Net MVC4?
Use templates.
An ITEM TEMPLATE and then an EDIT TEMPLATE.
When the user presses the EDIT button, set the action to change to mode of the form to EDIT.
In the TListView control, you can edit an item by clicking on it twice. A box appears around the item for user to type in a new value. How can I enable edit mode programmatically? I would like to protect the list from accidental editing, and disable editing (by enabling the ReadOnly property). Then, when the user presses an Edit button, the item will become active to edit. How can I do this?
Also, if suppose the user selects an item, then scrolls out of that item's view, then presses Edit, the list needs to first scroll to make that item visible.
After setting ReadOnly to false you can call the EditCaption method. Call MakeVisible to scroll the item in view.
ListView1.Items[0].MakeVisible(False);
ListView1.items[0].EditCaption;
I am working on MVC with C#.
I have 2 radio buttons. On selecting first radio button, a textbox will be shown which allows to enter date values.
<%= Html.TextBox("ReceivedDate")%>
on selecting the second radio button, the textbox gets hidden.
For the first time, when i select first radio button and entered date and clicked Next to navigate to next page and came back to this page again and clicked second radio button and clicked Next to continue and again i came back to this page and without changing any option click continue, its not allowing to navigate and shows an error.
A value is required.
Which means the ModelState validating the hidden controls also.
Please suggest how to control it
Instead of hiding it remove the element from the DOM and reinsert it if the first item is selected again. Another way would be to change the name of the input control to something else (a key not present in your model data) when the first item is not selected.
Validating hidden input types is a good thing, i often use them to synchronize data from complex controls (like a treeview with checkboxes). An input type with a hidden css style doesn't make it not submit with the form it belongs too.