Form Action

Vhjkeffwd

New Member
I am having trouble with manipulating the form action. In ASP, it seemed such as simple thing to call a function from a button, and have that button change the form action prior to submitting the form.<BR><BR>eg<BR><BR><script language="VB" runat=server><BR>....<BR>Sub btnLogin_OnClick(sender As Object, e As EventArgs)<BR><BR>***<BR>*** Whatever code I put in here, I get an error, unless I want to<BR>*** manipulate the on screen values or objects<BR><BR>End Sub<BR>....<BR></script><BR>....<BR><form method="post" runat="server" name="connx"><BR>....<BR>all sortsastuff<BR>....<BR><button id=btnLogin onServerClick="btnLogin_OnClick" <BR>style="font:xx-small;color:#ffffff;background-color:#666699;<BR>border: 1px solid #330033;height=21;width:120"<BR>onmouseover="this.style.backgroundColor='#9999cc'"<BR>onmouseout="this.style.backgroundColor='#666699'"<BR>runat="server"><BR><asp:Label id="lblCnct" Text="Connect" runat="server"/><BR></button><BR>....<BR></form>Shouldn't be <asp:button> instead of <button> ?<BR>Unless it's a typo on your part :(<BR><BR>Also, shouldn't be "onclick" attribute instead of "onServerClick" ?<BR><BR>try this simple script and from there add your code in order to find the error. Also if you don't indicate the "action" attribute in the <form> it will postback to itself but I'm sure you're aware of that!<BR><BR>ok so here is a simple example that uses a .aspx file with a button that when clicked, will display some text in a label<BR><BR><script language="vb" runat="server"><BR>...<BR>Sub btnLogin_OnClick(sender As Object, e As EventArgs)<BR> lblText.Text = "So far everything works!"<BR>End Sub<BR></script><BR><BR><html><BR><body><BR><BR><form runat="server"><BR><BR><asp:button id="btnMyButton" onclick="btnLogin_OnClick" runat="server"/><BR><BR><asp:label id="lblText" runat="server"/><BR></form><BR><BR></body><BR></html><BR><BR>If that doesn't work then im affraid I was of no use :( sorry!
 
Back
Top