I want to reload part of my page upon form submit.
To do this i´d like to extract the selected fields from a Django multiselectfield.
Now I´m kinda stuck because Django renders the form like this:
Instead of select-Tags.
How can i extract which choices have been selected?
Or is there any way to return new information when the form has been selected without leaving the page?
You get the value in exactly the same way as for any other form field: via form.cleaned_data. In this case, form.cleaned_data['Messwerte'].
Related
So, I'm having a little issue here with angular and forms
I'm creating a dynamic form, and it works correctly, but I needed to add some validations.
So I started to follow this guide and I set it up correctly, but when I set the form tags to surround my form controls, I'm getting a blank form
But, if I comment the form tags, I get my form perfectly
Any idea of why this is happening???
I have a couple of validation to show fields based on values, like
custConfig is part of the scope, could the name of the form be interfering with the retrieval of the custConfig variable? and if its such, how can I fix this?
Thanks
Your using a repeater
ng-repeat="deliver in shipmentDetails"
Do you have anything in your object shipmentDetails array? if not then the form will not show anything
Hi I have a basic form in one of my Ruby On Rails views, it has an input tag and a placeholder. When I submit the form and then try to add another entry the values are kept from previously, what is the simplest way to clear the form fields after submitting. I guess I need to call some javascript onsubmit action when the form is submitted?
If someone could show me a simple example it would be great
I have an MVC3 application in Visual Studio 2010.
I have a view with several dropdowns that do javascript calls to populate dropdowns based on the selected value, some of which are disabled initially.
That all works great with the initial state of nothing. If I however pass routevalues to the dropdowns from a redirect to this action, I do get the value set correctly but it's not enabled like it should be on the dropdown for example and when I post the form, the ones that are greyed out are not passed back on the form.
How can I correct this?
Disabled form fields do not get POSTed. Have the value of each dropdown in a separate hidden field so that on from POST it is received on the server.
#Html.HiddenFor(x=>x.SomeID_1)
or
<%:Html.HiddenFor(x=>x.SomeID_1)%>
Another solution is to make them readonly but that way you dont get to edit them in the edit view
In my struts2 application, I have a JSP with two autocompleter fields and a submit button. The goal is when I submit, a table should be displayed in the same JSP (below the submit button) which populates data from the database (basing on the selected values of autocompleter).
I think definitely we should call some action(which goes to struts.xml and basing on the result some JSP will be shown). But, the idea is to display table in the same JSP. Can I achieve this by calling some action in a regular way. I am new to struts2 and can anyone help me providing a good solution.
You need to use ajax. Pass the value selected in the autocompleter to the ajax call as parameter and then you can return result list in the form of xml, json or whatever form you want.
There are many table plugins available to help displaying ajax result set in a table form. DataTables is my favourite.
For question regarding making ajax call/response in struts2 take a look here
Also, there is a struts2-jquery plugin available, you can explore that. Ihave not used it though
I wonder if anyone can advise? I have a JSP which contains two forms, both of which are mapped to the same servlet on the server.
Everything seems fine although when I submit one form, a necessary piece of data entered on the other form is not being submitted at the same time.
The first form is used to add or delete the address of an RSS feed. As there may be several addresses on the page, a table is used to store them. Each cell of the table contains a form like this for deletion:
<form action = "<c:url value = '/deleteRSSFeed?rssFeedURL=${rssFeedURL}' />" method = "post">
<input type = "image" src = "${imageFileURL}myApp_rightArrow.png" />
<input name = "writeWordcloud" type = "hidden" value = "true" />
</form>
And there is another form for adding a feed.
The situation is that upon submission of either of these forms, a wordcloud must be redrawn on the page. But the wordcloud's settings are contained in the other form.
As it not possible for me to merge the forms, can anyone tell me if I can share data betwen forms in HTML? Or better yet, is it possible to submit one form, and have this action submit the second form?
At this point, it is not practical for me to have the forms served by different servlets.
Thanks
Mr Morgan
By using Javascript (or better, jQuery), you can have hidden fields in one form get the other form's fields values before submitting.
Update
This fiddle shows the code you need: http://jsfiddle.net/MqsK8/1/
You should probably use a single form, and have the server-side script perform both actions.
Depending on your scenario, you may want to have two submit buttons for different tasks; the server can check which button was clicked.
It would if you can provide detail of what you are trying to do. You can use Javascript to add elements to DOM but again all of this will depend on your use-case.