AngularJs: Disabled submit button is gets enable from firebug console - validation

I am using ng:Disabled directive for disabling my submit button. Its working fine its not enabling until all the required input fields are getting filled, but when I am inspecting the element using Google chrome firebug console and manually delete the disabled attribute from submit button then its get "Enabled" and form is submitted. So my question is that how to handle this type of problem. There are any option to checking validate from controller and enable/disable submit button from controller.
Please give me some suggestion for this.
Basically I am referring this url: http://docs.angularjs.org/api/ng.directive:ngDisabled

Ensure your form doesn't have an action attribute, and hook up
the ng-submit
directive of the form element or the
ng-click
directive on the first button or input field of type submit.
See form for more details.
From that event handler you can perform additional validations and send form only if validation is OK or show an error otherwise.

Related

How can I show new modal or update the existed one after an input submit in Slack via API?

I need to show new modal after the submit of the previous one, but I need a trigger_id for it, and there is nothing about it after the submit.
I can use views.update API only instead, and I have a valid response, but the submit button closes the window and nothing happens on the client side after it all.
Slack doesn't show an input in modals without a submit button, so I can't use alternative buttons in the modal too, because a user anyway can click on the submit button and it will be closed.
Is it possible to show or update the modal after an input submit? For example, I need to take a data from the input and show it in the modal after, is it possible?
You could try updating the view using the response_action. That needs to happen within 3 seconds, but doesn't require a trigger_id. Docs for that are here.

CSRF not working properly in codeigniter

I am using codeigniter 3.0.6. Currently working on one page website where there is a search functionality. I have enabled the csrf_protection option in the codeigniter's config file, and used form_open() function to create form.
When I press submit button the search functionality works well, but after submit the form when I refresh the page (with any functionality to refresh the page ie. from keybord or browser refresh) then CSRF doesn't work and display the error "The action you have requested is not allowed.".
Note : I am using post method to submit the form & set csrf_regenerate to true.
The problem is with $config['csrf_regenerate'] = TRUE; set it to FALSE instead.
When TRUE every time you POST to the server the CSRF token changes value. The page must be fully reloaded in order for to receive the new token. A back button won't fully reload the page but the browser's refresh/reload button should.

spring form submission in a popup

I have a small problem in my first spring&hibernate application.
In my page, I would like to create a popup window (modal) which gives the possibility to send an email. So, this popup would display a spring form with a fied "subject" and a field "content".
The question is : how can I use the form binding mechanism of spring with this popup form if I don't want my main page (displayed behind the popup form) to be reloaded?
If i am not wrong, the content of the popup is a div present in the main page. So, If I submit the form in the popup, the whole page will be reloaded (through the mvc mechanism of spring) and this is exactly what I don't want.
Of course, I can submit my form via an ajax call to a spring controller, but in this case, how to handle the eventual errors in the form? I cannot use the spring form binding mechanism to display the errors on the popupform. Is it possible?
Do you know if there is a way to open a new window in a modal popup? So that this page and only this page would be reloaded during the submission of the form?
Actually, I am not sure of the best way to combine a popup containing a form and the form submission mechanism of spring. How to display the errors on the form in case of errors? after reload of the page, If there are some errors, I need to open my popup again in javascript and then display the errors on the popup, this is the only mean I see, but maybe there are easier solutions.
If you have, I would be happy to know it.
thanks a lot

MVC 3 - AutoPostback with CauseValidation=false Behavior

I'm familiar with the method of submitting a form via a change event like or a checkbox's check event. Most articles explain how to find the first form using jQuery and invoke it's submit() method. However, I wish to submit the form but not cause validation so the back-end can perform other actions. In my case, I have a dropdown that a users changes. Depending on the value, the back-end adds/removes certain controls. The issue I'm runing into is that the validation prevents the form from submitting.
Q: How do I submit the form so it does not perform client-side validation?
Remove the validation just before the form is submitted - check out the answers here How do I remove jQuery validation from a form?
I think you can just turn the validation off by calling #Html.EnableClientValidation(false)

Ajax.BeginForm OnSuccess not executed after Submit

I am trying to use a jquery dialog to edit data in an WebGrid. Everythings works fine until the Form is submitted, instead of return to the current page that is open the browser goes to the url of the controller action. I am using an HTML.ActionLink in the WebGrid that adds jquery behavior to a button the WebGrid, and that works fine. It opens the View in a jquery dialog. The dialog defines two buttons: an update button and a cancel button. Clicking the cancel button does nothing. Clicking the update button takes the browser to the controller url for the edit action with the item id. I have the jquery.unobtrusive-ajax.js library defined and I added the UnobtrusiveJavaScriptEnabled key in the Web.config file, although I am not sure it's needed. Has anyone experienced this behavior, any help is appreicated!
I've experienced this problem in two situations:
The event handler was not being
binded to the form's submit event, or it was not suppressing the default behavior (through event.preventDefault(); or return false;).
There was an error in the event
handler, causing it to fall back to the
default behavior.
Well this is how much I can try to help without any source.
When I had this issue I wasnt referencing the jquery-Ajax.unobtrusive library so ensure that's there too
From my entry at http://completedevelopment.blogspot.com/2011/02/unobstrusive-javascript-in-mvc-3-helps.html
1. Set the mentioned flag in the web.config: <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
2. Include a reference to the jQuery library ~/Scripts/jquery-1.4.4.js
3. Include a reference to the library that hooks this magic at ~/Scripts/jquery.unobtrusive-ajax.js

Resources