tags:

views:

46

answers:

2
<form method="POST" action="/customer/{{ action }}/">
<div style="float: right; 
             margin: 0px; padding: 05px; ">
Name:<select for="customer" >
<option value="{{ customer.name|escape }}" name="customer"></option><br />
</select>
<input type=submit value="delete">  
</div>
</form> 

Customer is a model,name is attribute it should display name in drop down box.Plz correct

A: 

You need do something like the below:

...
<select name="customer" id="customer">
    <option value="{{ customer.name|escape }}">{{ customer.name }}</option>
</select>
...

Read more about how to use the select tag here.

Rishabh Manocha
Rishabh Manocha:It isn't working,still it is empty.
DAFFODIL
After a cursory glance, on line 189 at http://dpaste.com/hold/167199/, you need `<option value="{{ customer.customer_name|escape }}">{{ customer.customer_name}}</option>`. However, as Daniel noted, you really need to read the Django Docs, and use the `form` you're passing into the template correctly.
Rishabh Manocha
+2  A: 

Seriously, you really need to read some documentation.

Firstly, read the documentation about HTML form tags. There's no for attribute on a select, and you need to supply a value between the open/close option tags.

Secondly, read the Django documentation. If you're doing a form, you should use the forms framework, which takes care of generating form elements for you.

Finally, if you want help with something like the above, you should post all relevant information. For instance, how is the customer attribute getting to your template in the first place?

Daniel Roseman
@Daniel Roseman: you can view full source code here,http://dpaste.com/166803/ plz crt it.
DAFFODIL
That source code has nothing to do with my question, which was 'how is the customer attribute getting to your template?'. You're not even showing the code that is rendering the template.
Daniel Roseman
@Daniel Roseman: you can view full source code here http://dpaste.com/hold/167199/
DAFFODIL