atrum
Members-
Posts
184 -
Joined
-
Last visited
Everything posted by atrum
-
Do you think something like this would work? onerror=handleErr var txt="" function handleErr(msg,url,l) { txt="There was an error on this page.\n\n" txt+="Error: " + msg + "\n" txt+="URL: " + url + "\n" txt+="Line: " + l + "\n\n" txt+="Click OK to continue.\n\n" alert(txt) return true } I dont really like that it comes up in a popup box. Is there a way to make this just write the error to the screen?
-
[SOLVED] Form validation, submitting before script finishes.
atrum replied to atrum's topic in Javascript Help
Hey guys, I acutally got it resolved. I used a while() statement in the email comparison check instead of a with() function validate_match(field1,field2,alerttxt) { while (field1,field2) { if (field1.value != field2.value) {alert(alerttxt);return false;} else {return true;} } } if (validate_match(txt_email_c,txt_email,"Emails do not match!")==false) {txt_email.focus();return false;} -
Hello all, I have little experience with javascript, but I am trying to change that. Today it dawned on me that learning how to script in javascript would be alot easier if I could see all the errors my code is putting out. For example in PHP, if I wanted to see any errors that my code may produce, I would simply enter. ini_set('display_errors','On'); How can I do that for javascript? Thank you in advance for your help.
-
[SOLVED] Form validation, submitting before script finishes.
atrum replied to atrum's topic in Javascript Help
hmmmmm. now that I think about it, I haven't tried just an if statement instead of with(). -
[SOLVED] Form validation, submitting before script finishes.
atrum posted a topic in Javascript Help
Hey guys, I need a little bit of help with an odd problem when validating a form in javascript. The issue is that the form submits before the javascript finishes validating all fields. It will validate up to compairing the two emails fields. txt_email, and txt_email_c, then it skips all other fields and submits the form. Here is my code. function validate_email(field,alerttxt) { with (field) { apos=value.indexOf("@"); dotpos=value.lastIndexOf("."); if (apos<1||dotpos-apos<2) {alert(alerttxt);return false;} else {return true;} } } function checkemail(field1,field2,alerttxt) { with (field1,field2) { if (field1.value != field2.value) {alert(alerttxt);return false;} else {return true;} } } function validate_required(field,alerttxt) { with (field) { if (value==null||value=="") {alert(alerttxt);return false;} else {return true;} } } function validate_form(thisform) { with(thisform) { if (validate_required(txt_firstname,"Firstname must be filled out!")==false) {txt_firstname.focus();return false;} if (validate_required(txt_lastname,"Lastname must be filled out!")==false) {txt_lastname.focus();return false;} if (validate_required(txt_email,"Email must be filled out!")==false) {txt_email.focus();return false;} if (validate_email(txt_email,"Not a valid email!")==false) {txt_email.focus();return false;} if (validate_required(txt_email_c,"Email must be confirmed!")==false) {txt_email_c.focus();return false;} if (checkemail(txt_email_c,txt_email,"Emails do not match!")==false) {txt_email_c.focus();return false;} if (validate_required(txt_dob,"Username must be filled out!")==false) {txt_birthdate.focus();return false;} if (validate_required(txt_password,"Password must be filled out!")==false) {txt_password.focus();return false;} if (validate_required(txt_password_c,"Password must be confirmed!")==false) {txt_password_c.focus();return false;} } } any help any one can provide in trouble shooting this issue would be appreciated. -
hmmm, would you mind explaining the code you gave me? I am a bit of a novice, and I am having a hard time understanding what the code is doing.
-
Thank you for the help. Yeah the reason I don't want to use much java is because of the very reason that I don't want to risk the java validation not working, and thus alowing people to put just anything in the database. I also need to setup someway to enforce a password requirements system. For example. Password must contain 1 upper case, 1 lower, 1 number, and 8 characters. Does any one have any clue on things like that
-
Does any one know a way to validate that all fields are filled out in a form with out writing an if else statement for each field? Here is kinda what I would like. On my form, I have 10 fields. I want to have the form validate that all fields are not equal to nothing before it submits the data. I think I may have to put the fields into an array, but I am not to savy on php yet. any help any one can provide will be appreciated.
-
So I am trying to set up some form validation for a register form. I have found many examples of how to display an alert box with an alert message, but what I would prefere doing is just writing the error to the page. Something like * Error, please fill in the [insert field name] If any would could provide some examples or just a quick little code snippet of how that would look. Here is what I am trying to do. if field =!"" { then submit the page } else write an error to the page Thanks in advance.
-
haha, omg! I must have been very tired, thanks for the assist.
-
Hello all, been trying to grab data from my database and use it as a value for a session. I can get it to display the data in a table without using a WHERE clause, and with out the if statement, but with those two added, I get just a blank screen with out any error. Would someone mind taking a look at this code, because I can't seem to find the problem. Thanks in advance. <?php session_start(); ini_set('display_errors','On'); include("constr.php"); $passwordHash = sha1($_POST['password']); $username ="$_POST[username]"; $sqlu ="SELECT * FROM ts_membership WHERE mUserName='$username' AND mPassword='$passwordHash'"; $result = mysql_query($sqlu) or die (mysql_error()); if (!mysql_query($sqlu,$sqlcon)) { die('Error: unable to connect (login.php):' . mysql_error()); } else while($row = mysql_fetch_array($result)) { $_SESSION['user']=$row['mUserName']; } //header('Location: ./home.php'); mysql_close($sqlcon); ?>
-
Hey guys, thanks alot for the help. I think I need to split the different functions up, like the login, the session, and the mysql connection before I try to combine them. The script seems to always fail on the sql results portion under mysql_fetch_array. Does anyone have any suggestions on reading material for what I am trying to accomplish?
-
Hello all, I am trying to teach my self php cookies, and php mysql authentication and I am not having much luck with it. When I submit my information on <http://tools.exiled-alliance.com/testsite/index.php>, The following Error is printed to the screen. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/cdorris/www/tools.exiled-alliance.com/testsite/home.php on line 16 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Select * FROM tbl_auth_user WHERE user_id='tools'' at line 1 Here is the login script: <?php ini_set('display_errors','On'); include("constr.php"); $passwordHash = sha1($_POST['password']); mysql_select_db("tools", $sqlcon); $user ="$_POST[username]"; $sqlu ="SELECT * FROM tbl_auth_user WHERE user_id ='$user'" ; if (!mysql_query($sqlu,$sqlcon)) { die('Error:' . mysql_error()); } else $row = mysql_fetch_array($sqlu); if(!$row['user_password'] = $passwordHash) { die('incorrect user name and or password' . mysql_error()); } mysql_close($sqlcon); include("setcookie.php"); header( 'Location: http://tools.exiled-alliance.com/testsite/home.php' ) ; ?> Here is the setcookie.php: <?php include("constr.php"); mysql_select_db("tools", $sqlcon); $user = $_POST['username']; $sqlu ="Select * FROM tbl_auth_user WHERE user_id='$user'"; setcookie("COOKIE:testsite", "$sqlu", time()+1500); ?> Here is the home.php page which the login script is set to redirect to. <?php ini_set('display_errors','On'); include("constr.php"); mysql_select_db("tools", $sqlcon); //$user1 = $_COOKIE["COOKIE:testsite"]; //$sqlu ="SELECT * FROM tbl_auth_user WHERE user_id ='$user'"; $sqlu ="SELECT * FROM tbl_auth_user WHERE user_id =" . $_COOKIE["COOKIE:testsite"] . ""; if (mysql_query($sqlu,$sqlcon)) { die('Error:' . mysql_error()); } while($row1 = mysql_fetch_array($sqlu)) { echo $row1['firstName']; } echo mysql_error(); ?> Steps to recreate issue: 1. browse to [http://tools.exiled-alliance.com/testsite/index.php] 2. login with. User: testuser, Pass:password I am honestly at wits end with this one, so any help you can provide would be greatly appreciated.
-
never mind, I need to learn to read posts all the way through before posting.
-
Ether that or you can just size the textarea to the size of a standard input text box using col and row values. (i know dumb suggestion, but what ever works.)
-
Read up on css, there is a way to do it there.. The only thing I am not sure about is using it in a textarea. but worth a try:) p { white-space: nowrap; }
-
Thanks, I am glad I asked about this, I have been able to clear up alot of my pages using this method.
-
Thanks, One more quick question though, is it better to us top or bottom with margin, or does it matter?
-
hmmm, well going by some of the examples I have seen. would doing this make sense? div { margin-bottom: 10cm; }
-
Could you give me an example, I don't have much experience with padding or margins. I would really appreciate it.
-
Hello all, recently I have been trying to design a menu using HTML and php, the issue I have is I want to separate the different subsections with out making a new page. So basically you could ether click a link to a section on a page or scroll down. My question is regarding the empty space between the sections, What is the best way to add empty space, or white space? At the moment, I am just using like 10x <br> tags, but somehow I think that seems a tad inefficient. Is there a better way to do this?
-
Ok. 1. What webserver are you using, (apache, iis, tomcat, ect) 2. is this a virtual host? 3. what is your default ssl port set to on your webserver's configuration (normally 443) What I am getting at is, could you provide more information. Also you may want to post this in the webserver section for the forums.
-
I think I have answered my own question. I am assuming that there is not a way to "align" the section navigated too to the top of the screen, and that to do this, I just need to add "whitespace" or just some spacers to elonggate the page. again, any assistance would be appreciated. thanks.
-
Hello all, I have been scratching my head over this one for a while. I have a page with some anchor tags used for navigation of the parent page, but I cannot figure out how to get the tags to navigate to the top instead of just going to the first line where the anchor tag exists. http://exiled-alliance.com/tools/calltool/index.html Click on "Email Templates" and you will see what I mean. When you click on "Email Templates" I need it to align to the top of that section. Also here is the source <html> <head> <style type="text/css"> body { background-image: url('./images/bkgrnd.gif'); background-repeat: repeat } </style> <title>Report Generator </title> </head> <body> <a name="reports"><h2>Report Tool</h2><br> <a href="#email">Email Templates</a> BETA<br> <a href="https://forums.securesites.net/stats/ids/" target="frame2">Agent Stats</a><br> <FORM METHOD="post" ACTION="report.php" target="frame1"> Caller Name: <br> <input type="text" name="user"/><br> <br> Caller's Relation to Customer: <br> <input type="radio" name="customer" value="Main Contact" checked/> Main Contact <br> <input type="radio" name="customer" value="Listed contact"/> Listed Contact <br> <input type="radio" name="customer" value="Unlisted contact"/> Unlisted Contact <br> <br> Verified: <br> <input type="radio" name="verified" value="Username & Password" checked /> Username & Password<br> <input type="radio" name="verified" value="BTN" /> BTN <br> <input type="radio" name="verified" value="Back room pass phrase"/> Back room pass phrase <br> <input type="radio" name="verified" value="First 4 characters of the back room password."/> First 4 of the backroom password. <br> <input type="radio" name="verified" value="Last four digits of the credit card"/>Last four digits of the credit card <br> <input type="radio" name="verified" value="Caller did not provide any verification"/>Caller did not provide any verification <br> <br> Caller Asked/Wanted: <br> <textarea cols=25 rows=10 name="callerasked"></textarea> <br> System Info:<br> <textarea cols=25 rows=10 name="sinfo"></textarea> <br> Responder Found:<br> <textarea cols=25 rows=10 name="respond"></textarea> <br> Actions Taken: <br> <textarea cols=25 rows=10 name="action"></textarea> <br> Follow-up/Actions Needed: <br> <input type="radio" name="followup" value="None" checked/> None <br> <input type="radio" name="followup" value="Call Back"/> Call Back <br> <hr align="tr"> <br> <input type="submit" value="Submit"/> <input type="reset" name="reset" value="Reset Form"> </form> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <hr align="tr"> <a name="Email"><h2>Email Templates(BETA)</h2><br> <a href="#reports">Report Tool</a><br><br> <a href="./email/html/br_verio.html" target="frame1">Basic Response for Verio Customers</a><br> <a href="./email/html/br_att.html" target="frame1">Basic Response for AT&T Customers</a><br> <a href="./email/html/unauth_own.html" target="frame1">Unauthorized Contact to Account Owner</a><br> <a href="./email/html/unauth_request.html" target="frame1">Unauthorized Contact as Requester</a><br> <a href="./email/html/support_docs.html" target="frame1">Recomendation to Verio Support Docs</a><br> </body> </html> Any help would be greatly appreciated.
-
Hmm, well after reading my post over, you are right. I think I will explore other avenues. What I really need is a content management system.