new_php85 Posted May 11, 2011 Share Posted May 11, 2011 Hi guys.. sorry if I wrong placed the topic. I'm not sure is it under HTML or JS. I have problem with my tab position after refresh my page. Here is JS function checkAvaib() { var x=document.getElementById("form"); x.action="student_new.php"; x.target="_self"; x.submit(); } Here is HTML <input type="text" name="user_id" id="user_id" maxlength="10" value="<?php echo $_REQUEST["user_id"];?>" onblur="checkAvaib()" tabindex="15"/> <input type="text" name="name" id="name" value="<?php echo $_REQUEST["name"];?>" tabindex="16"/> When I start enter at user_id field and then tab to the next field(name). It will refresh the page and tab position going to the first tab. Is it possible to point the tab to the next tab after refresh? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/236057-tab-position-problem-after-refresh/ Share on other sites More sharing options...
Adam Posted May 11, 2011 Share Posted May 11, 2011 Do you use CSS or JS to power the tabs? Can you show the code? Quote Link to comment https://forums.phpfreaks.com/topic/236057-tab-position-problem-after-refresh/#findComment-1213829 Share on other sites More sharing options...
new_php85 Posted May 12, 2011 Author Share Posted May 12, 2011 Actually its more on cursor position. but usually when i works on data entry i use TAB at keyboard to move the cursor. thats y i call tab position. Sorry if this post confusing u. actually i got one solution. but i thinks is not a good solution. By using $_SESSION the cursor position remain to the next field/tab. If i hv better solution, please be free to share. thank you... Quote Link to comment https://forums.phpfreaks.com/topic/236057-tab-position-problem-after-refresh/#findComment-1214214 Share on other sites More sharing options...
Adam Posted May 12, 2011 Share Posted May 12, 2011 How will you update the session variable each time they tab to the next field? Quote Link to comment https://forums.phpfreaks.com/topic/236057-tab-position-problem-after-refresh/#findComment-1214344 Share on other sites More sharing options...
new_php85 Posted May 13, 2011 Author Share Posted May 13, 2011 Actually once i go direct to the page I set $_SESSSION["SESSION_CURSOR"]=""; when page start works on JS which is at onblur="checkAvaib()" i update $_SESSSION["SESSION_CURSOR"]=1; on html its look like :- <input type="text" name="location" id="location" maxlength="10" value="<?php echo $_REQUEST["location"];?>" tabindex="<?php if($_SESSSION["SESSION_CURSOR"]==1){echo "14";} else {echo "false";}?>"/> <input type="text" name="user_id" id="user_id" maxlength="10" value="<?php echo $_REQUEST["user_id"];?>" onblur="checkAvaib()" tabindex="15"/> <input type="text" name="name" id="name" value="<?php echo $_REQUEST["name"];?>" tabindex="16"/> Before this, after page refresh, the tab going to the location but now its going to the name. This not a really good solution. its better do in Ajax. for me its takes time to change the whole code into ajax but i i'll change it next time. Quote Link to comment https://forums.phpfreaks.com/topic/236057-tab-position-problem-after-refresh/#findComment-1214766 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.