Jump to content

Dan06

Members
  • Posts

    103
  • Joined

  • Last visited

    Never

Everything posted by Dan06

  1. Dan06

    Divider line

    I tried the <hr> tag, but it too results in the same, ie Seemingly, the source of the problem is the "clear" property. When I remove the clear property from my css, the horizontal line comes to the the right of my left floated object and I am able to use margin-top: 100px to push the line down to where I want it. But when I include the clear property, the horizontal line comes flush up to the bottom of the left floated object (see above quote example). All I want, is a horizontal line that has a margin of 15px above and below the line. Suggestions?
  2. Dan06

    Divider line

    The suggested code doesn't work. My goal is to have content and divider display as follows: Currently, the content and divider are displaying as: The html is <div class="tab current"> <fieldset class="profilePicture"><legend>Current Profile Picture</legend> <div id="profileImg"></div> </fieldset> <br /> <form name="profileImgForm" id="profileImgForm" enctype="multipart/form-data" method="post" action="image_upload.php" target="imgUploadFrame"> <label class="label">Upload Picture:<br/> <input type="file" name="imgFile" id="imgFile" /><input type="submit" name="saveProfileImg" value="Save" /></label> </form><iframe name="imgUploadFrame" id="imgUploadFrame"></iframe><br /> <label class="label">Click below to remove picture <br/> <input style="vertical-align:bottom" type="button" name="removeProfilePic" id="removeProfilePic" value="Remove Profile Picture"/></label> <div id="editAddress" class="divider"></div> </div>
  3. Dan06

    Divider line

    I want to divide sections of my webpage with a "divider line," and have space of 15px above & below the line. The code I have for it is pretty simple: .divider{ clear: left; margin-top: 15px; padding-top: 15px; border-top: #999999 solid medium; } The space BELOW the line is as desired, but for some reason there is NO SPACE above the line. Suggestions on what might be wrong and how to fix it appreciated.
  4. I found the problem; it was with firefox's add-on firebug. I have anther js file that onload executes two POSTs. That for some reason causes an error in firebug, which results in the iframe code not running. Thanks for the help; I appreciate it.
  5. The src is for the parent and it contains the js function - ImgUpload(). Yes, both the parent and iframe are on the same server.
  6. I have an iframe and when it loads I want it to run js code from a file which is linked to the parent document. Currently, I get an error message stating: The iframe html code is (simplified): <html> <head> <script src="..." type="text/javascript"></script> </head> <body> <iframe name="imgUploadFrame" id="imgUploadFrame"></iframe> </body> </html> The js code in the iframe that is supposed to run the js code from the parent is: window.onload = function() { parent.ImgUpload(); } Help appreciated.
  7. I have multiple forms on the edit page and I don't want to have the page reload every form. I got the image file to upload to the server and update the location of the file in the database without refreshing the entire page by using an iframe, below is the code. <form name="ImgForm" id="ImgForm" enctype="multipart/form-data" method="post" action="image_upload.php" target="imgUploadFrame"> <label class="label">Upload Picture:<br/> <input type="file" name="imgFile" id="imgFile" /><input type="submit" name="saveImg" value="Save" /></label> </form> <iframe name="imgUploadFrame" id="imgUploadFrame"></iframe> However, I'm having trouble with displaying the image once the file is successfully uploaded. I'd like for javascript to monitor the updation of the file location in the database and once the file location information is updated in the database to display the image. Anyone know how to do that? Examples would be great. Thanks.
  8. I want to create an edit page that allows the user to select an image and insert/update that image into a database, and upon successful insertion of the image, immediately display that image in the edit page all without refreshing/reloading the page. I'm pretty sure AJAX can't do what I've described. Does anyone know how to do it? Examples/tutorials would be appreciated. Thanks.
  9. logoutCheck determines if session variables that were set during login are still active and if so, unsets and then destroys them, logging the user out of the website. Once the session variables are unset and destroyed, logoutCheck sends the user to the main page.
  10. When a certain text is "clicked" a function is supposed to be called. Currently, when the text is clicked the function is not being called and I can't figure out why. Below is the html, css, and js. <div id="logout">Logout</div> body #logout{ position: absolute; top: 80px; right: 15px; cursor: pointer; } body #logout:hover{ position: absolute; top: 75px; right: 15px; font: bold; font-size: 14pt; color:#FF0000; cursor: pointer; } $("#logout").click(function() { logoutCheck(); }); Any thoughts?
  11. I decided to use sessions. Once the user name and password are verified, I chose to create two session variables: user name and session id. Anytime an event occurs, i.e. clicking a button, refresh, etc. I set my javascript code to call a php function to verify if the two session variables are set. If they are set then the process can continue otherwise, the process ends and returns to the login page. Is this the best way to go or is there a better way? Thoughts, suggestions appreciated. Thanks.
  12. I have a form that is validated upon submission and if there are any errors a label error is shown. The problem only occurs when there is an error in the nested fieldset. The label errors are supposed to show next to the input field. However, when, and only when, there is an error in the nested fieldset, the subsequent label errors, when shown, are displayed under the input field label rather then next to the input field itself. The above error only occurs in IE. In firefox, regardless of where/when the errors occur - in the nested fieldset or not - the labels are correctly displayed. Below are my css and html code, if some can tell me how to fix the problem so that IE shows the label errors correctly in all situation, it would be appreciated. Thanks. form.registration { margin-bottom: 10px; } form.registration legend { padding: 0 2px; font-weight: bold; color:#FF6600; } form.registration label { display: inline-block; line-height: 1.8; vertical-align: top; } form.registration fieldset ol { margin: 0; padding: 0; } form.registration fieldset li { list-style: none; padding: 5px; margin: 0; } form.registration fieldset fieldset { border: none; margin: 3px 0 0; } form.registration fieldset fieldset legend { margin-left: -10px; padding: 0 0 5px; font-weight: normal; color:#000000; } form.registration fieldset fieldset label { display: block; width: auto; } form.registration em { font-weight: bold; font-style: normal; color: #f00; } form.registration label { width: 160px; /* Width of labels */ } form.registration fieldset fieldset label { margin-left: 150px; } label.error{ background: transparent url(images/cancel.png) no-repeat scroll left; font-weight:normal; color:red; text-align:left; width:140px; padding-left:25px; display:inline; } <fieldset> <legend>Registration</legend> <ol> <li> <label for="firstName">First Name<em>*</em></label><input type="text" name="firstName" id="firstName"/> <label class="error" for="firstName" id="firstNameError"></label> </li> <li> <label for="lastName">Last Name<em>*</em></label><input type="text" name="lastName" id="lastName" /> <label class="error" for="lastName" id="lastNameError"></label> </li> <fieldset> <legend>Domestic or International?<em>*</em></legend> <label class="error" for="memberType" id="memberTypeError">This field is required.</label> <label><input type="radio" name="memberType" id="domestic" value="domestic"/>Domestic</label> <label><input type="radio" name="memberType" id="international" value="international" />International </label> </fieldset> <li> <label for="email">Email<em>*</em></label><input type="text" name="email" id="email" /> <label class="error" for="email" id="emailError"></label> </li> <li> <label for="password">Password<em>*</em></label><input type="password" name="password" id="password" /> <label class="error" for="password" id="passwordError"></label> </li> <li> <label for="confirmPassword">Confirm Password<em>*</em></label><input type="password" name="confirmPassword" id="confirmPassword" /> <label class="error" for="confirmPassword" id="confirmPasswordError"></label> </li> <center><p><input type="submit" name="signUp" value="Sign-Up"/></p></center> </ol> </fieldset>
  13. I have a multi-part question: 1. Once the user has entered his/her user name and password, and those have been verified, is it better to use cookies or sessions? 2. What type of information for authentication monitoring should be stored in the cookie or session, i.e. id, password, etc.? 3. How would I go about creating the proper cookie/session via javascript to use in AJAX? - code examples, would be great. Thanks. Insight appreciated. Thanks.
  14. Thanks for the pseudo-code, I used it as a guide to make the code for the message box that fades in/out with 3 seconds. The only change I made was using .fadeIn() and .fadeOut() instead of .show() and .hide()
  15. I have a form with one nested fieldset, which contains legends and labels. I'm using jQuery to perform a form validation. The javascript code correctly performs the validation for all parts of the form EXCEPT the nest fieldset - the validation code, simply overlooks the nested fieldset code. Below is the code for my form and validation; if someone knows why the validation is not working with the nest fieldset please let me know. I think I'm not correctly using jQuery's descendant selector. Thanks. <form name="Register" id="Register" class="registration" method="post" onsubmit="return Registration()" > <fieldset> <legend>Registration</legend> <ol> <li> <label for="firstName">First Name<em>*</em></label><input type="text" name="firstName" id="firstName"/> <label class="error" for="firstName" id="firstNameError">This field is required.</label> </li> <li> <label for="lastName">Last Name<em>*</em></label><input type="text" name="lastName" id="lastName" /> <label class="error" for="lastName" id="lastNameError">This field is required.</label> </li> <fieldset> <legend>Domestic or International?<em>*</em></legend> <label><input type="radio" name="joinType" id="domestic" value="domestic"/>Domestic</label> <label><input type="radio" name="joinType" id="international" value="international" />International</label> <label class="error" for="joinType" id="joinTypeError">This field is required.</label> </fieldset> <li> <label for="email">Email<em>*</em></label><input type="text" name="email" id="email" /> <label class="error" for="email" id="emailError">This field is required.</label> </li> <center><p><input type="submit" name="signUp" value="Sign-Up"/></p></center> </ol> </fieldset> <input type="hidden" name="type" value="Registration"/> </form> var interval = document.forms['Register'].elements['joinType'].length; for (i=0; i<interval; i++){ if(document.forms['Register'].elements['joinType'][i].checked){ var joinType = document.forms['Register'].elements['joinType'][i].value; } } if (joinType == ""){ $("label#joinTypeError").show(); $("input#domestic").focus(); return false; }
  16. I'd like to display a message box that fades in, remains for a few seconds, and then fades out. Additionally, I'd like the box to have only a message/image, no prompts, i.e. ok, cancel, etc. Does anyone have any examples for or tutorials of what I've described using jQuery?
  17. My previous post's answer is not completely correct. It does work, but will also collect unselected check boxes' empty values in the desired array. The better way to do it is checkedResults.push(checkboxElements[i].value); I incorrectly thought js, like php, allowed you to add to the end of an array with: checkedResults[] = checkboxElements[i].value;
  18. I got the code to work using checkbox arrays; and you were right, it was a lot easier. Thanks for the suggestion and the example code.
  19. I found the problem. checkedResults = checkboxElements[i].value; should be: checkedResults[] = checkboxElements[i].value; Once again, for those who had helped me, thanks.
  20. Thanks mjdamato and Nightslyr for your help with the code. Unfortunately, there seems to be problems with my js code. There was a problem with my php code, which I was able to fix by changing the dynamic checkbox names from being unique for each one to a checkbox array. That solved the php side issues... When using only php code I'm able to determine which checkboxes are selected and have them put into a string and then inserted into a table. However, when I try the js code to determine which checkboxes are selected and put them into a string, no checkbox values are gathered and inserted into a string, even though multiple checkboxes are selected. Below is the php and js code I'm using, if someone knows how to or has any suggestions to fix my problem please let me know. echo '<form name="categoryRegister" id="categoryRegister" method="post" onsubmit="return categoryRegistration()"> <table width="400" border="1" cellpadding="10" cellspacing="0"> <tr> <td>'; while($productRow = mysql_fetch_assoc($productCategoriesResult)){ echo '<center><input type="checkbox" name="categoryCheckbox[]" id="' . $productRow['categoryName'] . '" value="' . $productRow['categoryName'] . '" />' . $productRow['categoryName'] . '</center><br/>'; } echo ' </td> <td>'; while($serviceRow = mysql_fetch_assoc($serviceCategoriesResult)){ echo '<center><input type="checkbox" name="categoryCheckbox[]" id="' . $serviceRow['categoryName'] . '" value="' . $serviceRow['categoryName'] . '" />' . $serviceRow['categoryName'] . '</center><br/>'; } echo ' </td> </tr> <tr> <td colspan="2"><center><input type="submit" name="save" value="Save"/></center> <input type="hidden" name="type" value="categoryRegistration" /> </td> </tr> </table> </form>'; var checkboxElements = document.forms['categoryRegister'].elements['categoryCheckbox[]']; var elementsRange = checkboxElements.length; var checkedResults = []; for (i=0; i<elementsRange; i++){ if (checkboxElements[i].checked){ checkedResults = checkboxElements[i].value; } } var resultsList = checkedResults.join(','); var type = document.forms['categoryRegister'].elements['type'].value; var params = "resultsList=" + resultsList + "&type=" + type;
  21. I'd like to check this dynamic form to see if it properly creates checkboxes and the selected checkboxes have their values assigned to an array. I've put together some code to perform that check, but it is unable to: 1. Determine which (if any) checkboxes are selected. 2. Assign the selected checkbox value to an array. At this point I'm not sure if the form code is wrong or the code for checking the form is wrong. Below is my code. If anyone could tell me what is wrong with the verifying portion of the code or the dynamic form it would be appreciated. Thanks. <html> <head> <?php $domesticGoods = "SELECT categoryName FROM categories WHERE categoryType='Domestic'"; $domesticGoodsResult = mysql_query($domesticGoods, $connected); $internationalGoods = "SELECT categoryName FROM categories WHERE categoryType='International'"; $internationalGoodsResult = mysql_query($internationalGoods, $connected); echo '<form name="categoryRegister" id="categoryRegister" method="post"> <table width="600" border="0" cellpadding="10" cellspacing="0"> <tr> <td>'; while($domesticRow = msql_fetch_assoc($domesticGoodsResult)){ echo '<center><input type="checkbox" name= "' . $domesticRow['categoryName'] . '" id="' . $domesticRow['categoryName'] . '" value="' . $domesticRow['categoryName'] . '" />' . $domesticRow['categoryName'] . '</center><br/>'; } echo '</td> <td>'; while($interRow = msql_fetch_assoc($internationalGoodsResult)){ echo '<center><input type="checkbox" name= "' . $interRow['categoryName'] . '" id="' . $interRow['categoryName'] . '" value="' . $interRow['categoryName'] . '" />' . $interRow['categoryName'] . '</center><br/>'; } echo ' </td> </tr> <tr> <td colspan="2"><center><input type="submit" name="save" value="save"/></center>'; </head> <body> if(isset($_POST['save'])){ while($domesticRow = mysql_fetch_assoc($domesticCategoriesResult)){ if(isset($_POST[$domesticRow['categoryName']])){ $domesticCategoryArray[] = $domesticRow['categoryName']; } } while($interRow = mysql_fetch_assoc($interCategoriesResult)){ if(isset($_POST[$interRow['categoryName']])){ $interCategoryArray[] = $interRow['categoryName']; } } $domesticCategoryString = implode("," , $domesticCategoryArray); echo $dom = ($domesticCategoryString != "") ? 'NOT EMPTY' : 'Product String EMPTY'; $interCategoryString = implode("," , $interCategoryArray); echo '<br/>'; echo $inter = ($interCategoryString != "") ? 'NOT EMPTY' : 'Service String EMPTY'; $categoryList = $domesticCategoryString . $interCategoryString; ?> </body> </html>
  22. Well, the goal is to use AJAX... I can't get php to convert the resultant array into a string via implode()... I'm not sure if the problem is in the js or php code. I get the error message: I've put my js & php code below. If anyone has any suggestions/ideas, let me know. Thanks. var formElements = document.forms['categoryRegister'].elements; var elementsRange = formElements.length; var checkedResults = []; for (i=0; i<elementsRange; i++){ if (formElements[i].type == "checkbox" && formElements[i].checked){ checkedResults = formElements[i].value; } } $categoryListingArray = $_POST['checkedResults']; $categoryListing = implode(',' , $categoryListingArray); $updateQuery = sprintf("UPDATE goods SET categoryListing=%s WHERE Id=" . "'" . $_SESSION['registrationId'] . "'", $format->formatValue($categoryListing));
  23. Nightslyr, thanks for the clarification on the .elements component of the code as well as on how to keep track of which check box(es) are accessed. My goal was to have javascript determine which check boxes were selected and return those values to a processing php page, so they could be inserted into a db. Your code and explanations has helped me understand how to accomplish that goal.
  24. I'm unclear on one aspect of Nightslyr's method, particularly, the .element[] component of the code. The form name is "categoryRegister" - so, the js should look like: var formElems = document.forms['categoryRegister'].elements['???'] But name do I give for the element, since the check boxes all have unique names/ids?
  25. The check boxes have unique names and unique ids, however, with respect to each check box the name is the same as the id. The php code for the form is below: <?php echo '<form name="categoryRegister" id="categoryRegister" method="post" onsubmit="return categoryRegistration()"> <table width="600" border="0" cellpadding="10" cellspacing="0"> <tr> <td>'; while($domesticRow = msql_fetch_assoc($domesticGoodsResult)){ echo '<center><input type="checkbox" name= ' . $domesticRow['categoryName'] . ' id=' . $domesticRow['categoryName'] . ' value=' . $domesticRow['categoryName'] . ' />' . $domesticRow['categoryName'] . '</center><br/>'; } echo '</td> <td>'; while($interRow = msql_fetch_assoc($internationalGoodsResult)){ echo '<center><input type="checkbox" name= ' . $interRow['categoryName'] . ' id=' . $interRow['categoryName'] . ' value=' . $interRrow['categoryName'] . ' />' . $interRrow['categoryName'] . '</center><br/>'; } echo ' </td> </tr> <tr> <td colspan="2"><center><input type="submit" name="submit" value="Sign-Up"/></center> <input type="hidden" name="type" value="goodsInfo" /> </td>'; ?> I do name my forms and their elements, however, in my example code I removed their names. My intent was to give a general example of something I had used with radio buttons in another form.
×
×
  • 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.