Click here to Skip to main content
16,021,112 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Value is poulated successfully in given code alerts but it is not setting the value for that text field or page is not submitng?Not able find the problem why data is not set.Working fine in IE.Thec code is as follows:


<script type="text/javascript">
 
       <!-- #include file="../jscripts/script368.js" -->
     function newSearchWindow()
		{
		    var cugval="";		   
            cugval = window.showModalDialog('Testsearch.aspx','Testsearch','dialogWidth:900px;dialogHeight:600px;center:yes;status:no;');
					
			if (cugval != "")
			{
			alert(cugval);
			  document.forms[0].elements["<%=cugcode.ClientID%>"].value = cugval;	
			  alert( document.forms[0].elements["<%=cugcode.ClientID%>"].value);		 		 
			  document.forms[0].submit();
			}			
	   } </script>
<form>
 <input type="text" id="cugcode" class="text" size="20" name="cugcode"  runat="server"  önchange="submit()" /> 
</form>



I put a few alerts in, including just before and after the submit(). I get the alerts, but the submit action does not take place and also value is not set to the text field.

In the pop up window page codeis as follows
<script type="text/javascript">
            			function selectCUG(val)
			{
				window.returnValue = val;
				window.close();
			}
			document.body.onload = window.returnValue="";
    
    </script>
  <form>
<asp:TemplateField ItemStyle-HorizontalAlign="Left" ItemStyle-CssClass="gridcol1">
                                <itemtemplate>
                                <%# "<a href="#" önclick="javascript:selectCUG(" cugcode=").ToString() + ">" + DataBinder.Eval(Container.DataItem, "CUGCODE").ToString() + "</a>" %>                                                                                                
                                </itemtemplate>
                            
</form>
Posted
Updated 28-Mar-11 1:30am
v5
Comments
[no name] 28-Mar-11 5:54am    
What is the error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900