Re: Can't get value of select option from dynamically created form

Friday, October 18, 2013

Hi Ricky:



I was able to get the month by some direction of  my post,
What you gave me in your reply was what was already selected.  I need to get from the fomr what the user selected.


 var x = document.dynamicform.expirationMonth.selectedIndex;
  var gotit = document.dynamicform.expirationMonth.options[x].value;;  //this works


note this lacked results for several reasons one being appending everyhing correctly,

How ever the same does not work for year as the previous is an array if you notice from code I added.

The year is another matter.  I getting a strange result of something that is no where in my option example  AA

code
 var selectYear = document.createElement('select');
      selectYear.name="expirationYear";
      selectYear.id="expirationYear";
      selectYear.name="expirationYear";
         for(var i=2013; i<=2024; i++)
      {
         var yr = i;
         yr = document.createElement('option');
          yr.text=i;
          yr.name="year";
          yr.value=yr;
          selectYear.appendChild(yr);
      }
     



                                 var y=document.getElementById("expirationYear").selectedIndex;
                          
                                var snachit =  document.getElementsByTagName("option")[y].value;

I get a strange result for year AA in my alert when I choose something from drop down option. WOW what is this1
I know this is a challenge , I try not to put simple things that one should be able to figure out.  But once  I have done research and spinned
my wheels for a while I will ask a question in hopes the result will help someone else.

Sometimes when an answer does not come quickly you are forced to reason it out ,
if  that does not work walk away come back and step through it , else go to the pros and ask questions.


Thanking you in advance,
PH


On Wednesday, October 16, 2013 2:57:38 AM UTC-5, pame...@aol.com wrote:
Hello:


I attempting to update information from a form which consist of a text box and two drop down boxes.
I amble to get the information from the form for description but can't get date or year from drop down boxes.

This is what I use to get information from form for description

var des = document.dynamicform.description.value;

  var expmonth = document.dynamicform.mt.value  //this is from dropt down box doesn't work



Thank You In Advance,
PH

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Copyright © 2010 Web Design | Free Blogger Templates by Splashy Templates | Layout by Atomic Website Templates

Vida de bombeiro Recipes Informatica Humor Jokes Mensagens Curiosity Saude Video Games Animals Diario das Mensagens Eletronica Rei Jesus News Noticias da TV Artesanato Esportes Noticias Atuais Games Pets Career Religion Recreation Business Education Autos Academics Style Television Programming Motosport Humor News The Games Home Downs World News Internet Design Entertaimment Celebrities 1001 Games Doctor Pets Net Downs World Enter Jesus Mensagensr Android Rub Letras Dialogue cosmetics Genexus lasofia thebushrajr wingshock tripedes gorduravegetal dainfamia dejavu-transpersonal jsbenfica republicadasbadanas ruiherbon iranianforaryans eaystcheyl fotosdanadir Só Humor Curiosity Gifs Medical Female American Health Madeira Designer PPS Divertidas Estate Travel Estate Writing Computer Matilde Ocultos Matilde futebolcomnoticias girassol lettheworldturn topdigitalnet Bem amado enjohnny produceideas foodasticos cronicasdoimaginario downloadsdegraca compactandoletras newcuriosidades blogdoarmario arrozinhoii