|
|
![]() |
|
|
Top | #1 |
|
OSNN Veteran Addict
Joined: March 2002
Location: The Netherlands
Posts: 2,626
Reputation: 270
Power: 153 |
Code:
<FORM target="right" action="right.php" name="submit_message" method="GET"> <INPUT type="hidden" name="showrows" value="15"> <?php print "Name: <INPUT type=\"text\" name=\"name\" maxlength=\"25\" size=\"25\" ><BR>"; ?> Message: <INPUT type="message" name="text" maxlength="255" size="25" value=""><BR> <INPUT type="submit" value="SHOUT!"></FORM> Can anyone help me? edit: removed some code to correct the posts' width. |
|
|
|
|
|
Top | #2 |
|
NTFS Guru
Joined: January 2002
Location: Sweden
Posts: 4,006
Reputation: 890
Power: 175 |
I don't think it's possible without some tricks. You could make a hidden box.
PHP Code:
|
|
|
|
|
|
Top | #3 |
|
OSNN Veteran Addict
Joined: March 2002
Location: The Netherlands
Posts: 2,626
Reputation: 270
Power: 153 |
OK, I have put the document.bla part in SCRIPT tags and onClick=bla in my INPUT submit button. Is that correct? Either way, nothing happens, I click the button, but no text is submitted to the db. Also the text stays put.
click here for a demo (this is not the shoutbox in my sig) |
|
|
|
|
|
Top | #4 |
|
NTFS Guru
Joined: January 2002
Location: Sweden
Posts: 4,006
Reputation: 890
Power: 175 |
You seem to have removed the code again. You may need to have a type="button" instead of type="submit".
|
|
|
|
|
|
Top | #5 |
|
OSNN Veteran Addict
Joined: March 2002
Location: The Netherlands
Posts: 2,626
Reputation: 270
Power: 153 |
LOL, yeah. I shall try it now.
|
|
|
|
|
|
Top | #6 |
|
OSNN Veteran Addict
Joined: March 2002
Location: The Netherlands
Posts: 2,626
Reputation: 270
Power: 153 |
Hmm, nothing happens. Unfortunately I can't show the code properly atm, because I can't edit the file anymore somehow. I'll let you know when it's fully online again
|
|
|
|
|
|
Top | #7 |
|
OSNN Veteran Addict
Joined: March 2002
Location: The Netherlands
Posts: 2,626
Reputation: 270
Power: 153 |
Weee, I done it! This is how:
First, I made the button a 'reset' type, instead of submit. Added a Javascript (place between the <head></head> tags): Code:
<SCRIPT language="JavaScript"><!--
function submitIt(){
document.submit_message.submit();
return true;
}
//--></SCRIPT>
With this code, it first sends out the form values, and then it resets the fields (Because Name is cookied, Name is always filled in)Thank you Zedric for pointing me in the right direction and thank you Google for the inspiration (I made this script myself with bits and pieces I found with Google). |
|
|
|
|
|
Top | #8 |
|
OSNN Veteran Addict
Joined: March 2002
Location: The Netherlands
Posts: 2,626
Reputation: 270
Power: 153 |
I had a problem with submitting the text properly. Now that I made the submit button a reset button, I can't press enter - while in the message field - to submit the text. I found a javascript that checks if the Enter key is pressed (while in the message box) and if so, it executes some commands (which is, in this case, submit the form and reset the message field). Here's the script:
Code:
function onKeyPress (){
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;
if (keycode == 13) {
document.submit_message.submit();
window.document.submit_message.message.value = '';
return false;
}
return true;
}
document.onkeypress = onKeyPress;
Now is my question, can someone look at this code and tell me what to change to make it work in Mozilla AND in IE? (and the rest of the browsers of course, but these are most widely used) To see the script working: http://allhope.geffychan.co.uk/~glen...test/shout.php |
|
|
|
|
|
Top | #9 |
|
NTFS Guru
Joined: January 2002
Location: Sweden
Posts: 4,006
Reputation: 890
Power: 175 |
This can be a bit tricky as I noticed in my HTPC interface project.
Mozilla does this one way, IE another and Opera a third. Well almost anyway. PHP Code:
|
|
|
|
|
|
Top | #10 |
|
OSNN Veteran Addict
Joined: March 2002
Location: The Netherlands
Posts: 2,626
Reputation: 270
Power: 153 |
Nope does not work, not even in IE. I already put { and } at 'if (bla) { bla }' but that didn't work also. Do you have another suggestion?
|
|
|
|
|
|
Top | #11 |
|
NTFS Guru
Joined: January 2002
Location: Sweden
Posts: 4,006
Reputation: 890
Power: 175 |
That's extremely odd... I've tested this code in Mozilla, Opera and IE.
The PHP Code:
PHP Code:
|
|
|
|
|
|
Top | #12 |
|
NTFS Guru
Joined: January 2002
Location: Sweden
Posts: 4,006
Reputation: 890
Power: 175 |
PHP Code:
![]() if(key == 13) didn't cut it at all... |
|
|
|
|
|
Top | #13 |
|
OSNN Veteran Addict
Joined: March 2002
Location: The Netherlands
Posts: 2,626
Reputation: 270
Power: 153 |
Do I have to replace if (key == 13) with that line?
|
|
|
|
|
|
Top | #14 |
|
OSNN Veteran Addict
Joined: March 2002
Location: The Netherlands
Posts: 2,626
Reputation: 270
Power: 153 |
Nevermind, got it to work! But it only works when you have document.captureEvents(Event.KEYDOWN); and document.onkeydown = getKey; and not the submit_message shiz in it.
Now I can sleep well ( ) and finish the rest of the script.Thank you very, very much! |
|
|
|
|
|
Top | #15 |
|
NTFS Guru
Joined: January 2002
Location: Sweden
Posts: 4,006
Reputation: 890
Power: 175 |
Sweeet
|
|
|
|
|
|
Top | #16 |
|
*
Joined: December 2001
Location: USA
Posts: 6,496
Reputation: 2808
Power: 220 |
Javascript is crap.
|
|
|
|
|
|
Top | #17 |
|
OSNN Veteran Addict
Joined: March 2002
Location: The Netherlands
Posts: 2,626
Reputation: 270
Power: 153 |
OK, X-Istence, then tell me a better way to do what I want.
|
|
|
|
|
|
Top | #18 |
|
NTFS Guru
Joined: January 2002
Location: Sweden
Posts: 4,006
Reputation: 890
Power: 175 |
I don't believe there is unless you count VBScript... He's just being like he always is.
But he's right, Javascript is crap... ![]() [edit]Unless you do everything an entirely different way with the frames and all of course... |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [HTML] Text revolving | Kev2012 | Web Design & Coding | 7 | October 11th, 2004 7:20pm |
| [HTML]/[Javascript] Empty field on submit | Glaanieboy | Web Design & Coding | 11 | March 26th, 2004 4:00am |
| HTML text and stuff | Geffy | Web Design & Coding | 6 | February 3rd, 2003 9:08pm |
| help with HTML and text input spaces | jkoXP | Web Design & Coding | 3 | December 25th, 2002 11:02am |
| Interet Explorer "Text-Field History" | Cute | Windows Desktop Systems | 4 | August 15th, 2002 8:59pm |