Jump to content

Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/236057-tab-position-problem-after-refresh/
Share on other sites

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... :D

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.