473,387 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DJANGO HTML Multiple select

kaarthikeyapreyan
Inside my form tags of test.html i have this code

Expand|Select|Wrap|Line Numbers
  1. <select id="PairedSelectBox" name="target_objects" multiple size="15">
  2. <option value="MD_1">MD_1</option>
  3. <option value="MD_2">MD_2</option>
  4. <option value="MD_3" selected="selected">MD_3</option>
  5. <option value="C_1"selected="selected">C_1</option>
  6. </select>
  7.  
  8.  
in my views.py when i do

request.POST.getlist('target_objects')

it returns -> ['MD_1'] this is the option that is highlighted in the front end.
My expected result should return either all the tags or one's with selected attribute not just the highlighted one's.
Dec 14 '15 #1
2 4232
Luk3r
300 256MB
Have you tried getting an array of target objects? Something like the following should work:

Expand|Select|Wrap|Line Numbers
  1. request.POST.getlist('target_objects[]')
Dec 14 '15 #2
unfortunately yes and Django v1.8.5 returns a empty list if i try that option
Dec 15 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ramses van Pinxteren | last post by:
hello, I have a PHP/Javascript problem. If I want to make a multiple select like this one: $html .= "<td><select name='userid' onChange='changeuserinfo()' multiple size='10'>"; $html .=...
1
by: puneet.bansal | last post by:
Hi, I want to know the index of the option that a user clicks on in a multiple-select object (regardless of whether he selected or deselected it). This seems fairly simple but I can't seem to...
2
by: murraymiken | last post by:
I'm looking to have multiple multiple-select-boxes on a page. But I can only get the contents from the last selected value within a box, via PHP. I've tried numerous methods. What am I doing...
7
by: ozzii | last post by:
Hi I have a HTML form with a multiple select box. The multiple select box is populated from a database. A user can select multiple options form this select box and the infomrtaion is then stored...
0
by: sundsx | last post by:
Hi, i would sen multiple select to mysql by form, my prb is: file connect.php <?php $user="sundsx"; $pass="password"; $db="testphp"; $val_form=$_POST; $service =$_POST;
2
by: Problematic coder | last post by:
I have a need in an application to have the ability to select multiple values in some kind of drop down list or maybe even a html type select box. I have found there doesn't seem to be an option...
0
by: gnawz | last post by:
i have a multiple drop down with five items.. If i select 2 or more items and post, only one item is posted to the db! How do I make it post all the fields I have selected? The HTML list ...
1
by: mishasoft | last post by:
Hi all, I have a HTML multiple select (ListBox) control: <select id="mySelect" multiple> <option>Apple</option> <option>Orange</option> <option>Pineapple</option> ...
25
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if my question needs to be here or in coldfusion. If i have my question is in the wrong section i am sorry in advance an will move it to the correct section. ...
3
by: kipthemann | last post by:
My form processor is giving me a bit of trouble for some unknown reason. I was sure I had both my form and my processor correctly scripted. I am pretty new to this though. All of the fields except...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.