Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
How to get the javascript on-change function value in html template to Django views

Here is my script in html template

'''function yesnoCheck() {

  if (document.getElementById('yesCheck').checked) {
      siv=document.getElementById('ifYes').style.display = 'block';
      // siv = document.getElementById("yesCheck").value;
      document.getElementById('ifNo').style.display = 'none';
      alert(siv);

  }
  if (document.getElementById('noCheck').checked) {
      document.getElementById('ifYes').style.display = 'none';
      srv=document.getElementById('ifNo').style.display = 'block';
      alert(srv); 

  }

}'''

Below is my views code

      '''if request.method =='POST':
           if request.POST.get('basis1')=='here i need the data from alert(siv)' 

                return render(request,'stockissue2.html')
           elif request.POST.get('basis2')=='here i need the data from alert(srv)':
         
                    messages.success(request,'Record Saved Successfully...!')
                    return render(request,'stockissue2.html')
           else:
                 messages.info(request,'Material Not Available or Transaction No. wrong') 
                 return render(request,'stockissue2.html')'''

Please help me out..

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!