Jump to content

AndrewJ1313

Newly Registered
  • Posts

    47
  • Joined

  • Last visited

Everything posted by AndrewJ1313

  1. Ahhh, got it figured out. I was missing a key element when I was testing this earlier. I needed to add a to document.getElementById(fieldRequired[i]).style.background="Yellow"; and then insert this line within this section: case "textarea": if (obj.value == "" || obj.value == null){ alertMsg += " - " + fieldDescription[i] + "\n"; document.getElementById(fieldRequired[i]).style.background="Yellow"; } I kept trying by using "obj" or fieldRequired but with no .
  2. Sure, mjdamato. Here is a sample with this code and several form fields: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>test</title> <script language="JavaScript"> <!-- function formCheck(formobj){ // Enter name of mandatory fields var fieldRequired = Array("first_name", "last_name", "home_phone", "cell_phone", "email_address", "street", "city", "state", "zip_code"); // Enter field description to appear in the dialog box var fieldDescription = Array("First name", "Last name", "Home phone", "Cell phone", "Email address", "Address", "City", "State", "Zip"); // dialog message var alertMsg = "Please complete the following fields:\n"; var l_Msg = alertMsg.length; for (var i = 0; i < fieldRequired.length; i++){ var obj = formobj.elements[fieldRequired[i]]; if (obj){ switch(obj.type){ case "select-one": if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "select-multiple": if (obj.selectedIndex == -1){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "text": case "textarea": if (obj.value == "" || obj.value == null){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; default: } if (obj.type == undefined){ var blnchecked = false; for (var j = 0; j < obj.length; j++){ if (obj[j].checked){ blnchecked = true; } } if (!blnchecked){ alertMsg += " - " + fieldDescription[i] + "\n"; } } } } if (alertMsg.length == l_Msg){ return true; }else{ alert(alertMsg); return false; } } // --></script> </head> <body> <div id="header"> <p class="clear"></p> <div class="jg_ea"> <form action="process_form.php" method="post" name="adminForm" id="adminForm" onsubmit="return formCheck(this);"> <fieldset><legend>General Information</legend> <div id="personal_information_first_name"> <div>First Name:</div> <input type="text" name="first_name" id="first_name" maxlength="250" value = "" /> </div> <div id="personal_information_middle_name"> <div>Middle Name:</div> <input type="text" name="middle_name" id="middle_name" maxlength="250" value = "" /> </div> <div id="personal_information_last_name"> <div>Last Name:</div> <input type="text" name="last_name" id="last_name" maxlength="250" value = "" /> </div> <div id="personal_information_home_phone"> <div>Home Phone:</div> <input type="text" name="home_phone" id="home_phone" maxlength="20" value = "" /> </div> <div id="personal_information_work_phone"> <div>Work Phone:</div> <input type="text" name="work_phone" id="work_phone" maxlength="20" value = "" /> </div> <div id="personal_information_cell_phone"> <div>Cell Phone:</div> <input type="text" name="cell_phone" id="cell_phone" maxlength="20" value = "" /> </div> <div id="personal_information_email_address"> <div>Email Address:</div> <input type="text" name="email_address" id="email_address" maxlength="250" value = "" /> </div> <div><br /> <input class="submitbutton" type="submit" name="submit" onclick="formCheck(this);" value="Submit" /> </div> </fieldset> </form> </div> </body> </html>
  3. I have a script I am using to validate a form with roughly 134 form fields (employment app). It validates perfectly, but on return, I would like to have the background color of any required field change to yellow if it is left null. I have tried several things and each one seems to break the function. Here is the code I'm using: <!-- function formCheck(formobj){ // Enter name of mandatory fields var fieldRequired = Array("list of required fields"); // Enter field description to appear in the dialog box var fieldDescription = Array("field descriptions to display in alert box"); // dialog message var alertMsg = "Please complete the following fields:\n"; var l_Msg = alertMsg.length; for (var i = 0; i < fieldRequired.length; i++){ var obj = formobj.elements[fieldRequired[i]]; if (obj){ switch(obj.type){ case "select-one": if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "select-multiple": if (obj.selectedIndex == -1){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "text": case "textarea": if (obj.value == "" || obj.value == null){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; default: } if (obj.type == undefined){ var blnchecked = false; for (var j = 0; j < obj.length; j++){ if (obj[j].checked){ blnchecked = true; } } if (!blnchecked){ alertMsg += " - " + fieldDescription[i] + "\n"; } } } } if (alertMsg.length == l_Msg){ return true; }else{ alert(alertMsg); return false; } } // --> Any suggestions are appreciated.
  4. Crap, I knew it would be simple and I was just not seeing it. Thanks.
  5. I am just wondering if there is a PHP script/command that can evaluate if all form fields from a given form are completed upon submitting. Example: If I have a form with three form fields (name, email, phone), do I have to setup a if($_POST['name'] == '' || $_POST['email'] == '' || $_POST['phone'] == '') { redirect with error } else { continue } to evaluate if each was completed or is there a short cut that will automatically determine if any fields were left blank? Just curious. Thanks to any and all responses.
  6. I'm hoping someone here can help me. I have a friend who is moving her site from one server to another. I have read WordPress' documentation on this and followed the directions exactly, but other than the home page displaying, the site is not working. Here is the current site: http://ciscoco.com/ Here is the new temp url: http://ecbiz97.inmotionhosting.com/~ciscoc6/ The site is using a Atahualpa theme. Unfortunately, I did not setup this original site, so I'm not sure of what configuration changes were made, but I copied all files over to the new server, but the do not appear to be working as some styles are missing from the home page. All of the sub pages seem to be missing when I click their respective menu items. Would the temp url have anything to do with this? I have moved WordPress sites before and never had this problem. Thanks to all who might have a suggestion. Andrew
  7. I'm trying to simply add the mod_syndicate to all my pages on a site. I have created the new module, named it and it is published, but it will not display on any of my pages, not even the module titled (yes, I have it set to display on all pages). I have uploaded my template to another server all together and tested it there and the module works fine. Does anyone have any idea where I can begin to solve this issue? The server the module works on is GoDaddy, the host it won't work on is InMotion. The InMotion server is currently launched through a temp url as the site is not finished or live and the DNS info has not been resolved - would that have something to do with it? Thanks for any input. Andrew
  8. I have a client with a site in Joomla and they have a blog. They would like to have the ability to display blog posts from other sites that are relevant to their industry. They're not trying to "steal" content, just automatically re-syndicate it on their own site (giving credit to the orginal source of course). Is this possible with RSS? Is this possible within Joomla? Any and all responses most appreciated. Thanks, Andrew
  9. Greetings all! I have been diving into the world's of Joomla and Wordpress the last few weeks. I have a client who currently has their site in Joomla and want's to add a blog to it. I have found a few blog modules for purchase, but didn't know if there were any good free ones that will allow the user to post new articles, allow comments and allow me to create a "latest blog" region on the home page. It seems like it shouldn't be that hard as Joomla currently has the built in latest blog module already, it just doesn't allow users to comment. Just asking if anyone has any recommendations. Thanks, Andrew
  10. Can anyone point me in a direction to learn how to "flatten" a URL? I ask because I am just learning Joomla and see that all of the url's are displayed as "http://www.domain.com/joomla-folder/index.php?someinfo=123&moreinfo=123&evenmoreinfo=123". I would like the ability to change these to something more SEO friendly. Any info is greatly appreciated. Cheers, Andrew
  11. I knew I was over analyzing Thanks for the info!
  12. Is it possible to train your search query to find similar words to what the user submitted? Example, the word "Lobster" is in the database, using Full text search with IN BOOLEAN MODE, if the user submits "Lobst" and the wild card variable "*" is added after the word, it will find "Lobster", but is there a way to still get the proper results if the user were to enter the word "Lobsters" - or plural? Would it be best to automatically remove the last two letters of all words submitted that are over five characters long and just add the wild card? Just curious if there is an easier way to do this and I'm just over analyzing. Cheers, Andrew
  13. You could try a str_replace function (http://php.net/manual/en/function.str-replace.php) to replace spaces within the fields you do not want left blank. Once all spaces in a field are replaced with null value, you can check to see if they still contain any submitted data: // create variable of field $field = $_POST['name']; // replace spaces ' ' with null value '' $field = str_replace(' ', '', $field); // check if field is null if($field == '') { ...return error... } else { ...continue... } Hope this helps...
  14. I'm completely new to CMS systems such as Drupal, WordPress, Joomla, etc. Does anyone suggest one over another that has better design and programming add-on freedom? Just curious. Thanks, Andrew
  15. Thanks, PFMaBiSmAd - that did the trick. I knew I was over thinking it
  16. I have a section of a web site password protected via htaccess. The issue I am having is, I want to be able to have the user log in using an HTML form validating the user from a database of about 400 users instead of the default pop up for htaccess. I do not have access to directly alter code within the htaccess file as it is only controlled through a cPanel interface. Is there a work around to this beside passing "username:password@domain.com" ? From what I have read on google, this function doesn't even work in IE anymore and in Firefox, it still pops up with an alert message "You are about to log in to 'directory' using Username. Continue?" Is there a way to password protect a directory with just PHP? Protecting .php files is not the issue, it's various PDF and image files I need to protect. Thanks for any insight. Andrew
  17. Not sure what your question is or what kind of error you're getting, but for starters, in both query's, you're terminating before the closing quotes. mysql_query("ALTER TABLE `".PREFIX."cup_matches` ADD `1on1` INT( 11 ) NOT NULL default '1' AFTER `einspruch`;") else mysql_query("ALTER TABLE `".PREFIX."cup_matches` ADD `1on1` INT( 11 ) NOT NULL default '0' AFTER `einspruch`;") Should be: ...einspruch`" Also, "if" and "elseif" statements need curly brackets: if(something = true) { ...do somehing... } else { ...do this instead... } Hope that helps.
  18. I am trying to password protect a section of a web site. I have the login script written and it works fine, as do all of the document level restrictions. I want to be able to also restrict access to various image directories using .htaccess, which is also setup and working. My problem is I want my logged in users to be able to access these directories without having to enter another password. Is there a way to pass the username/password to .htaccess with PHP avoiding the .htaccess popup? I have trawled google for hours and was hoping someone here might have a thought or two. Thanks to all, Andrew
  19. All I'm trying to do is get a PDF converted into a JPEG image. I'm using ImageMagick to accomplish this, but it doesn't seem to be working. My web host says the path to ImageMagick is "/usr/bin/" or "/usr/local/bin/". Do I have to provide the absolute path to this or does it matter? I.E. should I use "http://www.domain.com/usr/bin/". Here is the code I am using: $path = "/usr/bin/"; exec($path."convert ../images/test.pdf ../images/new.jpg") or die('not gonna do it'); All I get is "not gonna do it." I have been beating my head against the wall for days and everywhere I look, I find no usefull resources that help me figure out what I'm doing wrong. I'm pretty sure it has something to do with the path I am using, but I don't know what else to do. Can someone please offer some guidance on what I am doing wrong and how to fix it. Much Thanks, Andrew
  20. Okay, according to GoDaddy, ImageMagick is installed and available on their servers and that the convert path for ImageMagick 5 is located at /usr/bin/ and for version 6 is at /usr/local/bin/...I'll be honest with you, I'm not even really sure what this means as I am a complete newbie to ImageMagick, all I'm trying to do is convert a PDF to a JPG on the fly for clients to review changes they have made to a document. Piecing together other code I have seen in other forums and after hours of Google searches, I am trying to use this: $originalImage = 'image.pdf'; $newImage = 'image.jpg'; $path = "/usr/local/bin/"; exec($path . "convert $originalImage $newImage") or die("not gonna do it"); All I get is "not gonna do it". I have beaten my head against the wall for several days now trying different things and I just don't have a clue what to do. Can anyone offer any suggestions that don't involve a link to ImageMagick.net as the web site only talks about using ImageMagick from the command line and I need to make this work with PHP on a web site. Much thanks to anyone with a suggestion. Thanks, Andrew
  21. I need to convert a PDF to a JPEG with PHP and I have been searching for a solution. I'm seeing the I need to download and install GhostScript and ImageMagick to do this. My problem is, the site I'm workin on is hosted on a GoDaddy server - can I install these services on a GoDaddy server or is there a better way to do this without GhostScript and ImageMagick? Thanks for all input.
  22. Sorry, it has taken me so long to reply. I have been on vacation since the 1st. You are correct about the date format. I adjusted the script and it is working fine now. Thanks, Andrew
  23. I have a count down script I use for (drum roll please) counting down to certain events. I have been using the script since August for weekly events and it has worked fine. There is an event for this afternoon and for some reason, the script has worked all week until today. It is now reading that the event date and time have been reached and is displaying the event now text. My question is: is there an issue with Javascript and the year 2010? I have had some similar issues with PHP as well concerning the date.
  24. Thanks for the feedback. I've never really spent any time with Javascript, so I have no idea how to do what you suggest. Can you provide a link to a tutorial or such? Thanks, Andrew
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.