Click here to Skip to main content
15,889,651 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionNode js Reading HTML page Pin
Member 1304854330-Mar-17 0:31
Member 1304854330-Mar-17 0:31 
QuestionHow to implement a custom javascript type to act like a dictionary ? Pin
Izis29-Mar-17 10:54
Izis29-Mar-17 10:54 
QuestionIs this closure correct ? Pin
Izis29-Mar-17 7:27
Izis29-Mar-17 7:27 
AnswerRe: Is this closure correct ? Pin
Richard Deeming29-Mar-17 7:49
mveRichard Deeming29-Mar-17 7:49 
GeneralRe: Is this closure correct ? Pin
Izis29-Mar-17 8:56
Izis29-Mar-17 8:56 
QuestionPrint HTML file using ActiveX Pin
Christopher Cote27-Mar-17 3:36
Christopher Cote27-Mar-17 3:36 
SuggestionRe: Print HTML file using ActiveX Pin
Richard Deeming27-Mar-17 7:49
mveRichard Deeming27-Mar-17 7:49 
QuestionDynamicaly Created Controls using Javascripted is not posting while submitting theform Pin
Member 1308703727-Mar-17 2:12
Member 1308703727-Mar-17 2:12 
I have a from named CAT_ADD in which the user can add any number of categories. A table contains category selection (Option list), No. of hours (Input box) & a question Do you want to add more categories? yes/ no . (Radio buttons). If the user click 'Yes' button a Javascript function Hello() is called. It add a new row with option list filled with PHP query CAT_fill, no. of hours with PHP code Hour_fill & Ans_fill. When the user Clicks NO button the form is submitted and calls a PHP file called PROCESS.PHP.
My problem is that the values of the controls created dyanamically are not posted or not available in the PROCESS.PHP. Please help. Here is the code section.

<script type="text/javascript">
function hello(p)
{
   var table = document.getElementById("myTable");
   var x = document.getElementById("myTable").rows.length;
   var y = document.getElementById("myTable").rows[x-1].cells;
   y[2].innerHTML = "*********";	//removes (yes/no)
  
   var row = table.insertRow(-1);
   var cell1 = row.insertCell(0);
   var cell2 = row.insertCell(1);
   var cell3 = row.insertCell(2);
	++x; //increased one row

	var y = document.getElementById("myTable").rows[x-1].cells;
	var z = "<?php echo cat_name_fill();?>";
    y[0].innerHTML = z;
	
	y[1].innerHTML = "<?php echo hour_fill();?>";
  
	y[2].innerHTML = "<?php echo ans_fill();?>" ;

	document.getElementById("myTable").rows[x-1].appendChild(row);
}


function cat_name_fill() //cat_name fill box
	{
		   	 $f_name=md5($_GET['usr_name']);
			 $con = mysqli_connect("localhost","root");
			 mysqli_select_db($con,"admin"); // connect to the database
			 $query = "Select CAT from " . $f_name ;
			 $result= (mysqli_query($con,$query));
			 $row=mysqli_fetch_row($result);
			 $query = "SELECT * FROM quest_category";
			 $result = mysqli_query($con,$query);
		echo "<select name='CAT[]'>";
			  while($row=mysqli_fetch_array($result, MYSQLI_ASSOC)){  
    					 echo "<option value='".$row['CODE']."'>".$row['SUBJECT']."              </option>";
				 }
		echo "</select>";		
	}


function hour_fill() //houre fill box
{

    echo "<input type='text' name='h[]' style='text-align:center' size='20' value='0'>";

function ans_fill() //answer fill box
{
    echo "<input type='radio'  value='N' onclick ='f_submit()'  checked> No   ";
    echo  "<input type='radio' value='Y' onclick = 'hello()'> Yes";
}


function f_submit()
{
	var r = confirm("Submit the form?");
    if (r == true) {
	 document.getElementById('cat_add').submit();
    }

AnswerRe: Dynamicaly Created Controls using Javascripted is not posting while submitting theform Pin
F-ES Sitecore28-Mar-17 22:41
professionalF-ES Sitecore28-Mar-17 22:41 
QuestionElements hidden - if visible do something Pin
Member 1307408621-Mar-17 3:42
Member 1307408621-Mar-17 3:42 
QuestionRe: Elements hidden - if visible do something Pin
ZurdoDev21-Mar-17 4:19
professionalZurdoDev21-Mar-17 4:19 
AnswerRe: Elements hidden - if visible do something Pin
Member 1307408621-Mar-17 4:34
Member 1307408621-Mar-17 4:34 
GeneralRe: Elements hidden - if visible do something Pin
ZurdoDev27-Mar-17 1:59
professionalZurdoDev27-Mar-17 1:59 
Questiondataset with java Pin
Member 1307317120-Mar-17 22:01
Member 1307317120-Mar-17 22:01 
AnswerRe: dataset with java Pin
Richard MacCutchan20-Mar-17 23:06
mveRichard MacCutchan20-Mar-17 23:06 
QuestionDisplay PDF in iframe from base64 string using blob url Pin
ankit1819-Mar-17 6:03
ankit1819-Mar-17 6:03 
SuggestionRe: Display PDF in iframe from base64 string using blob url Pin
ZurdoDev20-Mar-17 1:15
professionalZurdoDev20-Mar-17 1:15 
QuestionA more efficient approach? Pin
samflex10-Mar-17 3:54
samflex10-Mar-17 3:54 
AnswerRe: A more efficient approach? Pin
Nathan Minier16-Mar-17 4:41
professionalNathan Minier16-Mar-17 4:41 
GeneralRe: A more efficient approach? Pin
samflex17-Mar-17 3:01
samflex17-Mar-17 3:01 
AnswerRe: A more efficient approach? Pin
ZurdoDev16-Mar-17 5:38
professionalZurdoDev16-Mar-17 5:38 
QuestionOK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 6:43
professionalKevin Marois8-Mar-17 6:43 
AnswerRe: OK, What Am I doing Wrong ???? Pin
Richard Deeming8-Mar-17 8:06
mveRichard Deeming8-Mar-17 8:06 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Kevin Marois8-Mar-17 8:08
professionalKevin Marois8-Mar-17 8:08 
GeneralRe: OK, What Am I doing Wrong ???? Pin
Richard Deeming8-Mar-17 8:10
mveRichard Deeming8-Mar-17 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.