Fake out a field exit
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere HATS > Fake out a field exit




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Fake out a field exit  
Kenny Smith


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-28-06 01:48 AM

For those of you struggling with field exit, here is a way to implement
it with JavaScript. On your widget for the input field, click the
properties. For the 'Style' option, enter the following:

" onblur="fieldExit(this,4)"

The first quotation mark terminates the style element while creating the
onblur attribute for the HTML element. Next, add the javascript
function. I always recommend putting your JavaScript in js library. Here
is the function:

function fieldExit(field, fullLength){
var val = trim(field.value);
var missing = fullLength-val.length;
for(x=0;x<missing;x++){
val='0'+val;
}
field.value=val;
}

The fullLength variable is the maximum length of the field that you are
trying to field exit. Finally, if you have created a submit button (for
the [enter] event), add javascript for an onclick event to move the
cursor position out of the last field, to ensure the field exit function
fires.

Here is an example. The first argument of setCursorPosition is the
absolute cursor position.

<a name="[enter]" class="HostKeyLink" accesskey="HATSForm"
href="java script:ms('[enter]','hatsportletid')"
onclick="setCursorPosition(596, 'HATSForm');">Search</a>





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:45 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register