-
Simulate the 'Backspace' button being pressed in JS/JQuery
Thank you so much. It can be so annoying spending so long on something to find out that you only needed to include the following to fix it. .trigger("keyup"); I was stuck with this for hours. Many thanks. - MjA -
-
-
Submitting multiple forms with single button
Ditto to above, but 1 left. - MjA -
-
Submitting multiple forms with single button
Commenting as I need to get my post count up to 25 so I can send a PM, and I am 2 post counts short. - MjA -
-
Simulate the 'Backspace' button being pressed in JS/JQuery
@D4Y0 - I will send you a message with the details for where the site is hosted, and the login details, so you can have a look. I don't want to share sensitive information with too many people. - MjA -
-
Simulate the 'Backspace' button being pressed in JS/JQuery
@ Mikec1uk - I added the '.focus()' and this has still not fixed the issue. - MjA -
- Populate Drop-down List via Another Drop-down List
-
-
Simulate the 'Backspace' button being pressed in JS/JQuery
Hello, I currently have an input field which I am using as a search field. I have incorporated JQuery Ajax so that when you start typing in the input field it uses what has been typed and creates an <ul> of all the names which contain the input letters (In the same order they have been typed). The <ul>, which appears, hovers over my other divs and only appears when there is text in the input field. So, for example, if you type something in the input field, and then delete them all, the <ul> would disappear. When selecting one of the names from the list, I use this to trigger another event which loads relevant fields in the page, with the corresponding data to the person who's name you have clicked. This then get's triggered: $(document).ready(function() { $(".search").change(function() { $('#search').val(''); }); }); This picks up on the event of clicking on a name from the drop-down list and it successfully clears the input field (After running my other queries). HOWEVER the floating <ul> does not disappear. You have to then click in the empty input field and press the backspace key for it to disappear. Hence why I am wanting to find out how to simulate a backspace press using javascript / jquery. Any help with this matter will be greatly appreciated as I have been stumped with this for far too long now. Many thanks, - MjA -
-
Populate Drop-down List via Another Drop-down List
Thank you for your reply. I have very little experience with JavaScript (Possibly because I find it most difficult to understand out of all the web languages). Would you be able to explain what an ajax request is and how to use it? I have the following code which I need to run when a selection is made from the first drop-down list. This is in it's own PHP file called 'form_issue_getter.php' <?php session_start(); require_once('connection.php'); $choice = $_SESSION['fijournal']; $query = "SELECT Volume FROM tbl_jv_issues WHERE JournalID = $choice ORDER BY Volume"; $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<option style='color: black;' id='fijournal' name='fijournal'>"; echo $row['Volume']; echo "</option>"; } This is what I have on my main page, after what is posted in my first post; <select class="choice2" id="fivolume" name="fivolume" required="required"> <option style="color: grey" value="" disabled selected>Select journal first...</option> </select> <select class="choice3" id="fiissue" name="fiissue" required="required"> <option style="color: grey" value="" disabled selected>Select volume first...</option> </select> Would this setup work with your proposed AJAX solution or am I looking at this all from the wrong angle? - MjA -
-
Populate Drop-down List via Another Drop-down List
Hello, My query seems to be quite a simple one. The solution, however, I am finding great difficulty to find/understand. This is what I currently have; <select class="choice" id="fijournal" name="fijournal" required="required"> <option value="" disabled selected>Select journal...</option> <?php $clientid = $_SESSION['clientid']; require_once('connection.php'); $query = "SELECT ClientID, JournalID, Title FROM tbl_jv_journals WHERE ClientID = $clientid ORDER BY Title"; $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $journalid = $row['JournalID']; echo "<option id='fijournal' name='fijournal' value='$journalid'>"; echo $row['Title']; echo "</option>"; } ?> </select> What I need is to have a second Select drop-down list to be populated based on the choice made in this first one. I am fine with the php/mySQL side of things but I need help with the Javascript that is required to achieve this. The second Select drop-down list will house all relevant Volumes for the selected Journal and then, via a third drop-down list, all relevant issues shall be present. Upon conducting some online research (Including google searches and a lot of headaches) I just could not get my head around the few solutions I came across. I would very much appreciate a nod in the right direction and an explanation on how the solution works. Thank you for reading, - MjA -
-
Submitting multiple forms with single button
Thank you. At least now I know what to be working towards. - MjA -
-
-
Submitting multiple forms with single button
Is there any way around this then? I know it would be a lot easier to use a single form but would that work including the ReCaptcha? I'd rather know if I was working towards an achievable goal at least. - MjA -
-
Submitting multiple forms with single button
Hello, I am wanting to submit the values of multiple form inputs to $_SESSION variables by clicking a single button. I will include snippets of my code to help explain my situation. // First Form - Warrants the user to input a new email address, and then again to confirm it (Displays current email as placeholder text) <div class="sub2title"><h3>Enter a New Email Address</h3></div> <form method="post" class="myForms"> <div class="email"><label for="email">New email address <span style="color: #6C1739">* </span><input id="email" type="email" size="35" name="customeremail" placeholder=" <?php $row = mysql_fetch_array($result2, MYSQL_ASSOC); echo $row['Email']; ?> "/></label></div> <p><div class="email2"><label for="email2">Confirm email address <span style="color: #6C1739">* </span><input id="email2" size="35" type="email" name="customeremail2" placeholder=" <?php echo $row['Email']; ?> "/></label></div></p> </form> // Second Form - Similar to above. Warrants user to input a new username (Displays current username as placeholder text) <form method="post" class="myForms"> <div class="username"><label for="username">Username <span style="color: #6C1739">* </span><input id="username" type="text" size="27" name="customerusername" placeholder=" <?php echo $row['Username']; ?> "/></label></div> </form> // I have a couple other forms but I am sure you get the idea by now // The button I want to submit all forms is part of my reCaptcha form <form class="recaptcha" method="post" action="verify.php"> <?php require_once('recaptchalib.php'); $publickey = "6LeAde8SAAAAAFmIST1_Q9hFBDIzPt9jkWIAfC65"; echo recaptcha_get_html($publickey); ?> <p><button type="submit" id="clickMe" value="Submit ALL" class="buttonextra4 big grey">Update</button> </p> </form> I looked into using JS to do this, using this code: <script> $('.myForms').submit(function () { console.log(""); return true; }) $("#clickMe").click(function () { $(".myForms").trigger('submit'); // should show 3 alerts (one for each form submission) }); </script> I had no luck with this method though. Any help would be greatly appreciated. Either advice on how to get the current JS method to work or a better method. // My Goal? I want the values for all the form inputs to be submitted to $_SESSION variables so that during verify.php I can use these variables to run a mySQL Update query. - MjA -
-
-
Loosing $_SESSION Variables on Page Refresh
After much persistence I managed to figure out what was causing the issue, thanks to webdesigner93's suggestion of removing code bit by bit and testing. I have my navigation part of the site in an include php file. In this I have code for a log out button. In this code I included php code to destroy the current session when the log out button was pressed. When this navigation was first included in the home page everything worked fine. But for some reason when refreshing, or navigating away from the page, meaning the incoude had to be reloaded, it would run the php code for some reason. I don't know if it was the correct thing to do but my workaround is as follows; <?php session_start(); session_destroy(); header("Location: index.php"); This code is in it's own php page which is only accessible when the user clicks on log out and is directed to this page. I do not know why the php code was running before when loaded for a second time. Any insight into this? @andy9l - I am aware I am using deprecated code. The book I used to learn the basics from was a few years old and I figured as a first php project it would not matter so much. Out of curiosity, what sort of problems could I run into using such code? - MjA -
-
Accessing arrays from MySQL Query using PHP
I incorporated what I learned from your script and I have now got it working. Thank you for your help. - MjA -
-
Loosing $_SESSION Variables on Page Refresh
I set my $_SESSION variables during my login execution phase. This is the code being used if($result) { if(mysql_num_rows($result) > 0) { //Login Successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['clientid'] = $member['ClientID']; $_SESSION['username'] = $member['Username']; $_SESSION['password'] = $member['Password']; session_write_close(); header("location: home.php"); exit(); } else { //Login failed $errmsg_arr[] = 'user name and password not found'; $errflag = true; if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; header("location: login.php"); exit(); } } }else { die("Query failed"); } EDIT I have discovered now that it's not entirely based on just page refresh but actually any other page once its moved from index to home. I create the $_SESSION variables and it uses these to log in. It then uses these variables to populate some fields and tables on the home page. This all works fine. But then moving away to any other page loses the $_SESSION variables. This is the code I am using to navigate pages. Could this be the root cause of any of it? <button onclick="window.location.href='my_account.php'" class="buttonextra1 big grey">Account Overview</button> - MjA -