Monday, August 22, 2022

Re: I want to fetch the value of radio field for updation but it only doesn't fetch even i use condition and value does comes but doesn't checked

You'll need to use a RadioSelect widget. See example in the link as follows: https://docs.djangoproject.com/en/4.0/ref/forms/widgets/#django.forms.RadioSelect

On Mon, Aug 22, 2022 at 2:57 PM Abhinandan K <abhinandan@snakescript.com> wrote:
<label>Email</label>
<input type="email" name="email" value={{datas.email}}>
{% with val_gen=datas.gender%}
{{val_gen}}
<label>gender:</label><br></br>

<input type="radio" name="gender" value="Male"{% if val_gen == Male %} checked{% endif %} >Male</input>
<input type="radio" name="gender" value="Female"{% if val_gen == Female %} checked{% endif %}>Female</input><br><br>
<input type="submit" value="Update">
{% endwith %}
</form>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA6_Mp44RQjMeWfVW82vvT2-GLrv5Jpu2nb_6edWON_3sgXQwQ%40mail.gmail.com.


--
Abdul Qoyyuum Bin Haji Abdul Kadir
HP No: +673 720 8043

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA3DN%3DVe_NWF4kMxd18zW%3DOzND1YiYkvuyjmZgs5JxcX0UaQAQ%40mail.gmail.com.

No comments:

Post a Comment