Jump to content

AndrewJ1313

Newly Registered
  • Posts

    47
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

AndrewJ1313's Achievements

Member

Member (2/5)

0

Reputation

  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
×
×
  • 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.