Is there any good way to add URL-parameters to the rendered action attribute of a jsf form component ?
If there is a solution it has to be functioning without JavaScript.
Related
Up to this point, I’ve been using Microsoft Ajax for updates in my MVC app. I’m now switching to jQuery Ajax in order to standardize my approach.
However, I just realized that the required field in my model for the form did not fire and the user was able to submit the form even though some required fields were left blank.
What is the standard way to handle required fields if I’m handling my ajax functions using jQuery – i.e. I want the unobtrusive to handle my required fields by highlighting them and not allow the submit button to be clicked.
Also, to mention I am getting data-val attributes through the model.
P.S. I’m now using an event handler to detect click event on submit button for the form. In other words, I’m not using #using.Ajax.BeginForm to define my form.
I'm trying to figure out how unobtrusive validation works in asp.net mvc 3.
I would like to know what is triggering the validation check when I click to submit the form. How is the script jquery.validate.unobtrusive.js bound to the form submit event ?
I also would like to know how can I manually prevent/trigger this check.
jquery.validate.unobtrusive is a validator for jquery.validate. It is like a extension.
jquery.validate.unobtrusive implements all the events and jquery.validate use it.
You can look into the jQuery.validate.js file and see that it uses the submit of the
form.
// validate the form on submit
this.submit( function( event ) {
...
If you want to trigger the validation by yourself you can call
$("#myform").valid()
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)
I'm using microsoft ajax and ajax.beginform.
It's working great for model binding my partial view, but I need to conditionally disable some of the buttons in my form itself depending on what comes back from the server.
How can I go about this without using JQuery?
Have you thought instead about using two separate views instead, and have your conditional logic in your controller determine which view to display.
In my JSF page, I have a dropdown that needs to be populated onload of the page which is set in request scope, now I have a Ajax call that refreshes a part of the page.
The Ajax piece works fine but the issue is on refresh it also calls the getter for the Dropdown and returns null ( because its in request scope). To me it makes no sense to call the getter for a component that's not part of the Ajax refresh. Am I doing it correct , please suggest.
You'd have to specify which component you'd like to refresh. Depending on whether you are using jsf2 or richfaces (or any other technology), it is different, but it is often said in an attribute of the action component called render / reRender
Change the scope of managed bean to Session...