FireWatir: numeric values into text field

Discussion in 'Ruby' started by Void, Jul 19, 2011.

  1. Void

    Void Guest


    I'm new to Ruby and into di ng, but I hope to find a solution to the problem
    I'm facing. I need to make a quick script to put some values into some text
    fileds in a web page. This should be simple:


    BUT: there is a javascript check in the web page that raise an alert if the
    key pressed is not numeric:

    function onKeyNumeric(e) {
    if ( ((e.keyCode >= 48) && (e.keyCode <= 57)) ||
    ((e.keyCode >= 35) && (e.keyCode <= 40)) ||
    ((e.keyCode >= 45) && (e.keyCode <= 46)) ||
    ((e.keyCode >= 08) && (e.keyCode <= 09)) ||
    (e.keyCode >= 12) ) {
    return true;
    } else {
    alert ("Numeric only values accepted.");
    return false;

    I tried to set a "", but I got an error such as only
    string values could be put in.

    Any ideas?

    By the way, what does the following line mean? I don't understand its

    request = /javascript:sel.'#{links[index]}','/

    Void, Jul 19, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.