Jump to content
Server Maintenance This Week. ×

keyboard control substitution


colinkeefe

This topic is 7114 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Well, not exactly XML specific, although this is going into an xslt page.

I've been asked to build a web form for a user who must do all data entry using a numeric keypad.

I would like a way to substitute the behavior of the Enter key with the Tab key - so she can "tab" through the fields using the Enter key on the numeric keypad. I don't think accesskey tags will work here.

Of course, this might mean the behavior of the "submit" button will be broken, but I'll deal with that after I find out whether the above request is even possible.

Any ideas?

thanks in advance,

Colin

Link to comment
Share on other sites

That's more or less what I thought - except I'm not too javascript savvy, and can't see a simple way to implement it. So far as I can tell the Return key is bound to form submission, and can't be bound to another behavior. I seriously doubt any kind of field behavior inheritance is passed through the XSLT Assistant - not unless FM programmers put some serious javascript-writing stuff into the wizard too.

However, I just realized that the character strings the user will be entering are probably going to be fixed-length. Maybe I can use the length of the data entered to shift focus to the next field...which means I wouldn't need to have the user trigger moving to the next field manually anyway! hmmn this web stuff is all new to me...

Thanks Garry

Colin

Link to comment
Share on other sites

You can have a function, similar to this, in the <head> of your page:

<script>

function RetToTAB()

   {

   document.myform.nextelement.focus;

   }

</script>




Your Form tag may look like this:


<form name="myform" action="......" method="POST" onsubmit="RetToTAB(); return false;">

You will need to work-out which is the currently focused element and hence which is the "nextelement".

To submitt the Form you would have another Function which uses:

document.myform.submit();

You could have an <a> tag which calls that function.

You could also use other Javascript DOM functions to check focus, onchange, etc.

Good Luck.

Garry

Link to comment
Share on other sites

Well, I've tried about 5 different javascript solutions, which I can get to work in a straight-up html web form, but can't get to work inside an xslt page. Anything I should know about here? I've tried referring to the form elements by field name, giving the elements explicit names (which seem to get overwritten by the WPE with the fieldname anyway...) Most of the time the page fails to load altogether; sometime it loads but the javascript is stripped out when you view source - just the open and close tags are there.

Just some pointers, like stupid things to not do, etc, would be helpful.

Link to comment
Share on other sites

  • 2 weeks later...

Okay, I'm *still* working on this. I'm attaching a simplified version of my code, with two fields. I'd welcome any help from a Javascript guru... With javascript, it fails, without, it works fine. Note that the only change to the tags outside the header javascript is in the input tags, i.e. instead of:

input size="8" type="text" maxlength="8"

I have

input size="8" type="text" maxlength="8" name="Child_ID" onFocus="nextfield ='Therapist_ID';"

with open/close carats, obviously - when I put them in they get read as html by the post engine...

Any help appreciated, thanks!

Colin

Link to comment
Share on other sites

This topic is 7114 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.