www.webdeveloper.com
Results 1 to 2 of 2

Thread: Unterminated String Constant

  1. #1
    Join Date
    Jan 2010
    Posts
    41

    Unterminated String Constant

    Hi,

    I am adding table row dynamically while during the adding the row I am also fetching data through PHP but when I select the table field " CommodityName " browser give me the error "Unterminated String Constant".

    Can anybody help me in the matter.




    Code:
    var table = document.getElementById(tableID);
      var inputValue=document.indentForm.inputValue.value;
    
      inputValue=Number(inputValue)+1;
    
    
      
      var rowCount = table.rows.length;
      var row = table.insertRow(rowCount);
    
    
      var cell1 = row.insertCell(0);
      var element1 = document.createElement("select");
      element1.setAttribute("name","commidity[]");
      element1.setAttribute("id","commidity"+inputValue);
      element1.setAttribute("onchange","checkCode(this.id,this.value)");
      
      var optn = document.createElement("option");
      optn.text = "Select Item";
      element1.options.add(optn);
    
    	<?php
                          $result=mssql_query("select * from commidity");
    		  
    			if (mssql_num_rows($result)){
    			
    			      while ($row=mssql_fetch_array($result))
    				 {
    		     $id=$row['CommodityId'];
    		     $itemName=$row['CommodityName'];
    		 ?>
    				   var optn = document.createElement("option");
    				   optn.value='<?php echo $id; ?>';
    				   optn.text='<?php echo $itemName; ?>';
    				   element2.options.add(optn);
    				 
    
    
                     <?
    				 
    				 }
    
    			
    			
    		  }
    	?>
      
      
      cell2.appendChild(element2);

  2. #2
    Join Date
    Sep 2008
    Posts
    95
    Hello,

    Would any of your CommodityName rows contain a ' ? This may close the quotes in your script prematurely and toss this error.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles