doubledee Posted April 28, 2012 Share Posted April 28, 2012 I've got something really funky going on with one of my Forms, and have no clue what the problem is?! My Q&A Form has 5 dynamically generated TextAreas. If I click on a TextArea, control immediately hops to the *previous* TextArea. (I am NOT using any JavaScript.) Anything obvious that might cause that? Normally I would "debug" in NetBeans, but this weird "Field Hopping" behavior doesn't appear to be firing any code, so there is no way I can debug it... Debbie Quote Link to comment https://forums.phpfreaks.com/topic/261778-control-hoping-to-previous-form-field/ Share on other sites More sharing options...
kicken Posted April 28, 2012 Share Posted April 28, 2012 You may have an un-closed <label> tag, or one referencing the wrong element ID. Quote Link to comment https://forums.phpfreaks.com/topic/261778-control-hoping-to-previous-form-field/#findComment-1341446 Share on other sites More sharing options...
doubledee Posted April 28, 2012 Author Share Posted April 28, 2012 The problem seems to be coming from here... // Display Q&A. foreach($thoughtsArray as $questionNo => $qaArray){ // Build Question. echo '<label for="question' . $questionNo . '">' . $questionNo . '.) ' . $qaArray['questionText'] . "\n"; // Build Answer. echo '<textarea id="question' . $questionNo . '" cols="60" rows="2">'; // echo '<textarea id="question' . $questionNo . '" name=answer[' . $qaArray["questionID"] . ']" cols="60" rows="2">'; // echo (isset($questionNo) ? htmlentities($qaArray['answerText'], ENT_QUOTES) : ''); echo "</textarea>\n\n"; If I take out the id= part in this line above things go back to normal... echo '<textarea id="question' . $questionNo . '" cols="60" rows="2">'; Any idea what is happening?! Debbie Quote Link to comment https://forums.phpfreaks.com/topic/261778-control-hoping-to-previous-form-field/#findComment-1341447 Share on other sites More sharing options...
kicken Posted April 28, 2012 Share Posted April 28, 2012 Unless there is more to that loop which you did not show, your never closing your <label> tag. You need to add a </label> somewhere in the loop. Quote Link to comment https://forums.phpfreaks.com/topic/261778-control-hoping-to-previous-form-field/#findComment-1341461 Share on other sites More sharing options...
doubledee Posted April 29, 2012 Author Share Posted April 29, 2012 Unless there is more to that loop which you did not show, your never closing your <label> tag. You need to add a </label> somewhere in the loop. Looks like that was it?! You are brilliant!! Thanks, Debbie Quote Link to comment https://forums.phpfreaks.com/topic/261778-control-hoping-to-previous-form-field/#findComment-1341466 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.