Jump to content

Funce

Moderator
  • Posts

    602
  • Joined

  • Last visited

  • Days Won

    19

Everything posted by Funce

  1. You'll need to show us two, possibly three, snippets of code. Your table element showing your form input names. If the submission is done via JavaScript, we'll need to see that bit too. Your php showing the processing and database communication.
  2. Funce

    C#

    Closest thing we have for that is the Razor tutorials, but it doesn't go too in depth about it. https://www.w3schools.com/asp/razor_intro.asp
  3. Usually the green links have separate pages they link to. This means it doesn't matter what's left at the end of your time on a page. If you're doing a one-page based system, you might need to add the hamburger closing event onto the links.
  4. And all of the w3schools ad space is google powered, which only shows you what you've been looking at before that. If you do not like an ad, you can always report it in the corner of said ad if it says "powered by Google"
  5. Apologies vmars, I didn't intend to sound condescending or aggravated. If that is what you heard then allow me to apologize again. I'll keep this one short. Take my For Loop Take the Original Drag Element Code Replace dragElement code with my Replacement dragElement code (changing "header" to "mydivheader") Result: https://www.w3schools.com/code/tryit.asp?filename=G75VCGLH4SCA
  6. You've made a lot of unnecessary changes to the dragElement function. The whole function was never designed in such a way that it would take a collection. If you take my first post with the DragElement function, then before it include the for loop I provided, you won't have too many problems. If you're unsure about the use of functions, invocations and how they apply, have a look here: https://www.w3schools.com/js/js_function_definition.asp If you're specifically looking at our example, I'll provide a small explanation. The purpose of dragElement is to bind some onclick events to the provided element. Depending on if it has a header or not, depends on whether the header gets the behaviour or the whole element. dragElement(document.getElementById("mydiv")) in this case here, elmnt would be the Element returned by getElementById. In our example, we're trying to do multiple at the same time, so we first get a list of the elements that have the mydiv class. Then we need to bind each and every one of them with on click handlers. Binding the collection does nothing, as its not an Element and lacks the properties for binding. So a for loop is used as shown in my previous post. This means you may treat elmnt, as any one of your given mydiv Elements. Not all of them at once. Only one.
  7. In the HTML code, there are references to the words that are shown, and the image that is shown. <div class="container"> <img src="img_avatar.png" alt="Avatar" class="image"> <div class="overlay"> <div class="text">Hello World</div> </div> </div> Replace img_avatar.png with the file name of your own picture on your site to include yours, and change "Hello World" to whatever you would like written when you hover over it. To make this a link, you should be able to apply an <a> tag around the container with the link you want it to travel to. If you instead want a button inside your text area, you can put your <a> tag in there.
  8. This was made bold to emphasize that you spelled it wrong (as Element instead) and to indicate plurality. dragElement is only supposed to take an element, therefore elmnt is an Element. Passing in a NodeList will give you that TypeError, as a NodeList does not have that function. If you include my for loop, as written in my previous, in your code, we can see what the error is going forward from there.
  9. You haven't changed your headers from id= to class= in your HTML Also, you'll need to loop through the collection provided by getElementsByClass by using a for loop, rather than directly putting it into dragElement var mydivs = document.getElementsByClassName("mydiv"); for (var i = 0; i < mydivs.length; i++) { dragElement(mydivs[i]); } Disclaimer: Untested
  10. vmars, did this solution not work out for you? The code above should work with this type of HTML provided you've applied dragElement to each one of these that you require. <div class="mydiv"> <div class="header">Click here to move</div> <textarea class="textArea" rows="4" cols="20"> </textarea> </div> dragElement specifically takes a "mydiv" Element. dragElement only applies the "draggable" behaviour to the header. The reason why the function takes the mydiv Element instead of the header, is that sometimes the header doesn't exist and in that case the "draggable" behaviour is applied to mydiv. In regards to that other code, the textarea probably prevents propagation of click events in its center area, so it cannot be dragged unless you're right on the edge.
  11. Hi there, thanks for pointing that out. There is additional styling on the main page, than as compared to the try-it. In particular img { vertical-align: middle; } If you were to add the vertical align property to the try-it, it would produce the same result as the CSS page.
  12. Sharing some code might work well here. It sounds like you're attempting to define a word that nodejs already uses. It might have nothing to do with your SQL. We can't know for sure without seeing a little bit of code.
  13. mysqli_stmt::bind_param binds each variable to a matching parameter. You cannot match all of them to one. It doesn't work like that. (Neither can you attempt to use a string like an array) What you can do however, is bind an array using variable length argument lists. Use ... to indicate an argument list as below. <?php $vals = [101, "ASUS H61M-E", "abcde", 2, 1, 5300.00, 6500.00, 11, 5300, 55528, 101]; $uq = $mysqli->prepare("UPDATE $tbl SET $cols WHERE $whcol='$whval'"); if (!$uq) { $msg = "Error1: $mysqli->error!"; } else { $uq->bind_param('issiiddiiii', ...$vals);
  14. This question is very vague. You need to debug the code, and you didn't write it. Can you post a snippet of the code that shows the form?
  15. Does the popup not show any link? What browser are you using?
  16. You aren't passing your ID along with your edit action. You need to add a line like this <?php echo "<input type='hidden' name='id' value='".$row['id'] ."' />"; Rather than Echoing all your output, have you considered the following method? (<?= ?> is shorthand for <?php echo ?>) <table class="table table-bordered table-hover table-striped"> <thead> <tr> <th>ID</th> <th>Produto</th> <th>Valor</th> <th>Ações</th> </tr> </thead> <?php if ($result->num_rows > 0) { ?> <tbody> <?php while ($row = $result->fetch_assoc()) { ?> <tr> <td><?= $row['id']; ?></td>"; <td><?= $row['produto']; ?></td>"; <td><?= $row['valor']; ?></td>"; <td> <form action='deletar_produto.php' method='post'> <input type='hidden' name='id' value='<?= $row['id']; ?>' /> <button type='submit' class='btn btn-outline-primary' name='editar'>Editar</button> <button type='submit' class='btn btn-outline-primary' name='apagar'>Apagar</button> </form>"; </td>"; </tr> <?php } ?> </tbody> <?php } else { echo "0 results"; } ?> </table>
  17. Everything working fine on my end. Maybe it was a temporary outage. Can you try it again? Unless you're creating your own try it as hypothesized by JMRKER. Then you've got a whole different kettle of fish.
  18. Hey there vmars, your issue here is that getElementByID only ever gets one element. getElementsByClassName gets a collection of elements, so some things needs to be adjusted. You'll need to apply the DragElement function to all of the Elements in the collection. (For loop might work well) Your headers will no longer work as they use the passed element's id. You'll need to apply a "header" custom class, one that will exist on all the headers. You can then access this header element for dragging purposes by using the below code. function dragElement(elmnt) { var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; if (elmnt.getElementsByClassName("header")[0]) { /* if present, the header is where you move the DIV from:*/ elmnt.getElementsByClassName("header")[0].onmousedown = dragMouseDown; } else { /* otherwise, move the DIV from anywhere inside the DIV:*/ elmnt.onmousedown = dragMouseDown; } Try this and then go from there. Code block button is here if you've missed it. ev.target evaluates into the element that has been activated using the event (onmousedown, onmousemove etc). That will always evaluate to the .mydiv that was clicked. So rather than document.getElementById, you use ev.target inside this function.
  19. Funce

    silleone

    Map Coordinates? Is there a specific tutorial you are referring to? Or perhaps a map library that you're using?
  20. Funce

    TLJ232

    You might be able to do something like this. SELECT myFieldA FROM myTable WHERE (myFieldA - Trunc(myFieldA, 2) <> 0); Anything with a 0 decimal should end up as 0 and would be omitted. You can reverse this by changing <> to =
  21. Hi there Alejandro, The JSON HTML page is different to the JSON PHP due to what they are illustrating. Unlike some of the other tutorials, they do not use sequential examples. This is to avoid someone having to learn a lot of unrelated things to the page that they're currently on.
  22. <li> elements are block level tags, which means they usually take up the full page width, forcing the next li element to go on the next line. By floating them, we can take them out of normal page flow, and put them next to each other. Putting the float in li means that we float the li. This is the reason why its horizontal. Styling li a is actually styling the links and not the container. The container (li) normally goes vertically
  23. Ouch, yeah you're getting undefined because you're accessing the <select> element that has no data on it. You'll need to put what you had earlier to access the <option> element. <script> function eventFunction(eventname){ var selected = eventname.options[eventname.selectedIndex];//get the selected option var date = selected.dataset.eventdate;//get the data attributes of above var venue = selected.dataset.venuename; document.getElementById("eventdate").value=date;//set the data document.getElementById("venuename").value=venue; } </script> Hopefully this helps.
  24. Why would you need to remove the timestamps? You should be able to do this with a simple find and replace using a regular expression. ^<gx:TimeStamp>.+<\/gx:TimeStamp>$ The above should filter all the lines that match <gx:TimeStamp> blah blah </gx:TimeStamp>
  25. Hey there Jenny, Can you include some code for us so we can see what's going on here?
×
×
  • Create New...