SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2001
    Location
    Northern Virginia
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    split/url values

    on my first page I select one or multiple serial numbers that are submitted to the main page. on the main page it loops through the comma delimited list of serial numbers and displays them seperately with radio buttons associated to each serial number. when someone selects the radio button it will open a popup window and pass that particular serial number. I have tried to split out the individual serial numbers using the split command which I thought would then put the values into an array. I figured then I could select out each array value depending on which radio button I selected. for some reason it is not working. Inspecing the following code, can someone help me!!??

    var objSourceForm = document.forms['demate'];
    var sOldserials = objSourceForm.elements['maj_asm_serial_nbr'].value;
    var serials =sOldserials.split(',');
    var sString = '';

    for (i=0; i< serials.length; i++) {

    sString = serials[i];
    }

    var winOptions = window.open("red_reason_popup_demate.cfm?comp_condition="+lc+"&serial_nbr="+sString+"&maj_asm_name="+document.demate.maj_asm_name.value,"remotewin","width=325,height=225,chrome=yes, scrollbars=yes");

    I thought that the for loop will loop

    for (i=0; i<serials.length; i++) {
    sString = serials[i];
    alert (serials[i])
    }
    through two times and each time the serials[i] would be either serials[0] or serials[1]. I figure I need something else inside the for loop to relate the i to the loopcounter of the main page?

    I am attatching a gif screen shot to show you what i am displaying. each serial number has a radio button with a RED label. When you select that radio button, the associated serial number needs to be passed in the url as the popup window opens. I am already passing two other values in the url.

    sString = serials[i]; this is the line in my code that is not doing what I expected it to do.

    I hope this helps describe better what I am doing.

    Thanks

    Dan

  2. #2
    SitePoint Enthusiast JohnInFl's Avatar
    Join Date
    Sep 2001
    Location
    FL, USA
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Did you figure this out? Where is the attached image?

    I am a little confused about your explanation..


    Have you tried alerting this?

    var sOldserials = objSourceForm.elements['maj_asm_serial_nbr'].value;

    alert(sOldserials )

  3. #3
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i am also confused but here is where i would start. first of all, before you get into your loop throw an alert box to see what "serials.length" is:

    alert(serials.length);

    I had a question about this line:

    var sOldserials = objSourceForm.elements['maj_asm_serial_nbr'].value;

    I thought that for this type of DOM expression 'maj_asm_serial_nbr' would need to be an integer. By having it inside single quotes, it looks like it might get read as a string, not as a variable. If this expression isn't evaluating correctly it will mess up everything else.

    I could be wrong but to start, I would do like JohnInFl said and use an alert box as you work through your code to ensure that you are dealing with the values you think you are.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •