Hi,
I have a problem with formatting a table including text fields wich can
contain up to 255 chars.
I need a table with 3 columns:
- First column 50 % over the with a rowspan of the total number of rows.
- Second column 25 %, no rowspan
- Third column 25 %, no rowspan
In the first column / cell contains a description. The next column a
caption, and the last column a edit field.
See http://www.winit.nl/sample/1.html
This shows the right layout (Using IE 6). If a text fields has the focus,
pressing enter will submit the form.
But when the text in the fields is to big, the layout is wrong (but still,
enter = submit)
See http://www.winit.nl/sample/2.html
To solve this problem, I replaced the input type=text with a textarea with
style overflow=hidden .
Only the enter key now gives a newline instead of a submit
See http://www.winit.nl/sample/3.html
The prevent newlines in the textarea i can use some client side scripting.
See http://www.winit.nl/sample/4.html
But how to submit the form using enter, and still be able to use the event
trapping of the submit button in the aspx page?
(Or how to use a input type = text resulting in the right layout)?
Perry 10 3026
Hey,
Instead of submit button put a button on the page and invoke form submit if
your layout is matched. You can still retain your textbox.
(e.g)
<input type=button onclick="test() ;">
<script>
function test()
{
if (condition)
document.form1. submit();
}
</script>
Hope this would solve your issue. Let me know if you need any other
clarification.
-Baskar BV-
"Perry van Kuppeveld" wrote: Hi,
I have a problem with formatting a table including text fields wich can contain up to 255 chars.
I need a table with 3 columns: - First column 50 % over the with a rowspan of the total number of rows. - Second column 25 %, no rowspan - Third column 25 %, no rowspan
In the first column / cell contains a description. The next column a caption, and the last column a edit field.
See http://www.winit.nl/sample/1.html This shows the right layout (Using IE 6). If a text fields has the focus, pressing enter will submit the form.
But when the text in the fields is to big, the layout is wrong (but still, enter = submit) See http://www.winit.nl/sample/2.html
To solve this problem, I replaced the input type=text with a textarea with style overflow=hidden . Only the enter key now gives a newline instead of a submit See http://www.winit.nl/sample/3.html
The prevent newlines in the textarea i can use some client side scripting. See http://www.winit.nl/sample/4.html
But how to submit the form using enter, and still be able to use the event trapping of the submit button in the aspx page? (Or how to use a input type = text resulting in the right layout)?
Perry
If i use a document.form1. submit(); i don't get the server side click event
in the aspx file. I need this event on the server.
To get around that, create a button that submits to the server (input
type=button runat=server id=btn)
And in the JavaScript submit that button btn.Submit(), which will trigger
its Post Back as well
HTH
"Perry van Kuppeveld" <no************ *****@spam.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. If i use a document.form1. submit(); i don't get the server side click event in the aspx file. I need this event on the server.
I didnot get your question. Can you share the code which u have written?
-Baskar BV-
"Perry van Kuppeveld" wrote: If i use a document.form1. submit(); i don't get the server side click event in the aspx file. I need this event on the server.
I created a new C# webapp and placed the following code in webform class (In
design mode nothing is changed)
See the dif between pressing enter while the focus is in the textbox, or
clicking the submit button.
Code:
public class WebForm1 : System.Web.UI.P age
{
private void Page_Load(objec t sender, System.EventArg s e)
{
TextBox tb = new TextBox( );
tb.TextMode = TextBoxMode.Mul tiLine;
tb.Attributes["onkeypress "] = "if (event.keyCode == 13) {
document.forms[0].submit(); return false; }";
this.FindContro l("form1").Cont rols.Add(tb);
Button b = new Button();
b.Text = "Submit";
b.Click +=new EventHandler(b_ Click);
this.FindContro l("form1").Cont rols.Add(b);
}
override protected void OnInit(EventArg s e)
{
InitializeCompo nent();
base.OnInit(e);
}
private void InitializeCompo nent()
{
this.Load += new System.EventHan dler(this.Page_ Load);
}
private void b_Click(object sender, EventArgs e)
{
Response.Write( "Submit");
}
}
Hey,
try the code given below.
<script>
function test()
{
document.form1. button1.click() ;
}
</script>
<form method="post" name="form1" onsubmit="test( );" runat=server>
<input type=text>
<input type=button onclick="button _click" runat=server>
</form>
the code will invoke client "test" function which then invokes button1 click
event. So if the user submits the form by pressing enter you could check for
the format validation and submit or not accordingly.
"Perry" wrote: I created a new C# webapp and placed the following code in webform class (In design mode nothing is changed) See the dif between pressing enter while the focus is in the textbox, or clicking the submit button.
Code:
public class WebForm1 : System.Web.UI.P age { private void Page_Load(objec t sender, System.EventArg s e) { TextBox tb = new TextBox( ); tb.TextMode = TextBoxMode.Mul tiLine; tb.Attributes["onkeypress "] = "if (event.keyCode == 13) { document.forms[0].submit(); return false; }"; this.FindContro l("form1").Cont rols.Add(tb);
Button b = new Button(); b.Text = "Submit"; b.Click +=new EventHandler(b_ Click); this.FindContro l("form1").Cont rols.Add(b); }
override protected void OnInit(EventArg s e) { InitializeCompo nent(); base.OnInit(e); }
private void InitializeCompo nent() { this.Load += new System.EventHan dler(this.Page_ Load); }
private void b_Click(object sender, EventArgs e) { Response.Write( "Submit"); } }
I don't think this will work:
If i click the button script button_click will be executed, and that is not
available.
I will post a new question with the code provided in the previous post, so
it's back on the top.
Thanks anyway
"BASKAR BV" <BA******@discu ssions.microsof t.com> wrote in message
news:EC******** *************** ***********@mic rosoft.com... Hey,
try the code given below. <script> function test() { document.form1. button1.click() ; } </script> <form method="post" name="form1" onsubmit="test( );" runat=server> <input type=text> <input type=button onclick="button _click" runat=server> </form> the code will invoke client "test" function which then invokes button1 click event. So if the user submits the form by pressing enter you could check for the format validation and submit or not accordingly.
"Perry" wrote:
I created a new C# webapp and placed the following code in webform class (In design mode nothing is changed) See the dif between pressing enter while the focus is in the textbox, or clicking the submit button.
Code:
public class WebForm1 : System.Web.UI.P age { private void Page_Load(objec t sender, System.EventArg s e) { TextBox tb = new TextBox( ); tb.TextMode = TextBoxMode.Mul tiLine; tb.Attributes["onkeypress "] = "if (event.keyCode == 13) { document.forms[0].submit(); return false; }"; this.FindContro l("form1").Cont rols.Add(tb);
Button b = new Button(); b.Text = "Submit"; b.Click +=new EventHandler(b_ Click); this.FindContro l("form1").Cont rols.Add(b); }
override protected void OnInit(EventArg s e) { InitializeCompo nent(); base.OnInit(e); }
private void InitializeCompo nent() { this.Load += new System.EventHan dler(this.Page_ Load); }
private void b_Click(object sender, EventArgs e) { Response.Write( "Submit"); } }
You need to write the button_click event for the button. You can do that by
double clicking the button in the design view. In that case, your code will
be like
<input type=button runat=server name="button1"> . The click event will be
bound to the code behind.
-Baskar BV-
"Perry van Kuppeveld" wrote: I don't think this will work:
If i click the button script button_click will be executed, and that is not available.
I will post a new question with the code provided in the previous post, so it's back on the top.
Thanks anyway
"BASKAR BV" <BA******@discu ssions.microsof t.com> wrote in message news:EC******** *************** ***********@mic rosoft.com... Hey,
try the code given below. <script> function test() { document.form1. button1.click() ; } </script> <form method="post" name="form1" onsubmit="test( );" runat=server> <input type=text> <input type=button onclick="button _click" runat=server> </form> the code will invoke client "test" function which then invokes button1 click event. So if the user submits the form by pressing enter you could check for the format validation and submit or not accordingly.
"Perry" wrote:
I created a new C# webapp and placed the following code in webform class (In design mode nothing is changed) See the dif between pressing enter while the focus is in the textbox, or clicking the submit button.
Code:
public class WebForm1 : System.Web.UI.P age { private void Page_Load(objec t sender, System.EventArg s e) { TextBox tb = new TextBox( ); tb.TextMode = TextBoxMode.Mul tiLine; tb.Attributes["onkeypress "] = "if (event.keyCode == 13) { document.forms[0].submit(); return false; }"; this.FindContro l("form1").Cont rols.Add(tb);
Button b = new Button(); b.Text = "Submit"; b.Click +=new EventHandler(b_ Click); this.FindContro l("form1").Cont rols.Add(b); }
override protected void OnInit(EventArg s e) { InitializeCompo nent(); base.OnInit(e); }
private void InitializeCompo nent() { this.Load += new System.EventHan dler(this.Page_ Load); }
private void b_Click(object sender, EventArgs e) { Response.Write( "Submit"); } }
Thanks, it's working
Perry
"BASKAR BV" <BA******@discu ssions.microsof t.com> wrote in message
news:37******** *************** ***********@mic rosoft.com... You need to write the button_click event for the button. You can do that by double clicking the button in the design view. In that case, your code will be like <input type=button runat=server name="button1"> . The click event will be bound to the code behind.
-Baskar BV-
"Perry van Kuppeveld" wrote:
I don't think this will work:
If i click the button script button_click will be executed, and that is not available.
I will post a new question with the code provided in the previous post, so it's back on the top.
Thanks anyway
"BASKAR BV" <BA******@discu ssions.microsof t.com> wrote in message news:EC******** *************** ***********@mic rosoft.com... > Hey, > > try the code given below. > <script> > function test() > { > document.form1. button1.click() ; > } > </script> > <form method="post" name="form1" onsubmit="test( );" runat=server> > <input type=text> > <input type=button onclick="button _click" runat=server> > </form> > the code will invoke client "test" function which then invokes button1 > click > event. So if the user submits the form by pressing enter you could > check > for > the format validation and submit or not accordingly. > > "Perry" wrote: > >> I created a new C# webapp and placed the following code in webform >> class >> (In >> design mode nothing is changed) >> See the dif between pressing enter while the focus is in the textbox, >> or >> clicking the submit button. >> >> Code: >> >> >> public class WebForm1 : System.Web.UI.P age >> { >> private void Page_Load(objec t sender, System.EventArg s e) >> { >> TextBox tb = new TextBox( ); >> tb.TextMode = TextBoxMode.Mul tiLine; >> tb.Attributes["onkeypress "] = "if (event.keyCode == 13) { >> document.forms[0].submit(); return false; }"; >> this.FindContro l("form1").Cont rols.Add(tb); >> >> Button b = new Button(); >> b.Text = "Submit"; >> b.Click +=new EventHandler(b_ Click); >> this.FindContro l("form1").Cont rols.Add(b); >> } >> >> override protected void OnInit(EventArg s e) >> { >> InitializeCompo nent(); >> base.OnInit(e); >> } >> >> private void InitializeCompo nent() >> { >> this.Load += new System.EventHan dler(this.Page_ Load); >> } >> >> private void b_Click(object sender, EventArgs e) >> { >> Response.Write( "Submit"); >> } >> } >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dan Weeb |
last post by:
Hi All,
I have struggled through this far with help from many of you so thanks. I am
stuck again. I am really new to this so don't be harsh :-)
There are a few problems. You can run the script here
http://www.pbrown.com/research/test1.php to see the formatting issues
Formatting Issues
|
by: fish |
last post by:
Hi,
I have an HTML page with a FORM and some input fields.
On the fields I wish to do validation as the punters change the field
values.
If they get it wrong, then I tell them and then wish to put
the focus back to the offending field.
( It works if a use an 'onblur' event but not an 'onchange' )
|
by: Roger Withnell |
last post by:
Tearing hair out time! Simple attached page shows the problem.
http://www.brilley.co.uk/TestFocusSelect.htm
Using a function to test if too many characters have been keyed in to a
textarea. Obviously, must return focus and select to the textarea if too
many have been keyed.
When the function is called with onblur, it works in IE but not in Safari or
NN. The function is called but the focus() and select() methods fail.
|
by: tshad |
last post by:
I have a date validation function that I want to stay at the object I am
validating if there is a Validation error, but it always goes to the next
object.
The Javascript:
function ValidateForm(me){
var dt=me
if (isDate(dt.value)==false){
dt.focus()
|
by: Neil Ginsberg |
last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a
form with a subform (in continuous form view). A combo box on the main form
has code in the AfterUpdate event which adds a record to the subform (based
on the value of the combo box) and requeries the subform control. I want the
focus to return to the combo box on the main form when it's done, but I
can't get it to do so if the user enters a value and presses Enter...
| |
by: Christian Ista |
last post by:
Hello,
I found that (see below) to give the focus to a control(textbox) on an
asp.net page. There is no easiest way to do that ?
Thanks,
System.Text.StringBuilder sb = new System.Text.StringBuilder("");
sb.Append("<script language=\"JavaScript\">");
|
by: yuelinniao |
last post by:
hi, I have got a simple way to make "textarea" support "auto-submit"
when pressing Ctrl+Enter, and tested under both IE and Firefox.
The common old method is like this:
<form name=form2>
<textarea onkeydown='if(event.keyCode==13 && event.ctrlKey) return
document.form2.submit()'>
</textarea>
</form>
|
by: Jen |
last post by:
Hi. I have this problem that I think should be easy but have been struggling
with this for days.
I have a list based on a recordset from a database. This list consists of
records meeting a certain criteria and at the bottom of this list i have a
button that inserts all these records to a´nother table in the database. So
long everything's ok.
BUT, at the top of this list I have a textarea that the user can write down
some text to be put...
|
by: Jake Barnes |
last post by:
I'm researching the Enter key. This is for an Ajax chat application.
The designer tells me that she wants people to be able to submit text
simply by hitting the Enter key. She wants this to happen even if
people still have the cursor inside the textarea where they have just
been typing.
I started researching this and came upon this post by Michael Winter,
from 2004:
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |