Skip to Content
author's profile photo Former Member
Former Member

Javascript Example isn´t working

Hello

I´m trying to set the value of an inputField via Javascript. I found the following example in the pdk documentation:

Getting the inputField object in JavaScript:

function calculateCurrencyFromTo(){

var funcName = htmlb_formid+"_getHtmlbElementId";

func = window[funcName];

var inputfield = eval(func("currencyDisplay"));

// Now we have the inputField, so we can access it, for example set a new value

if (inputfield)

inputfield.setValue("100.23");

}

The only thing, that i´ve changed is the field id according to my field id.

I don´t have any clue why it isn´t working.

Do you have any ideas, or other solutions to fill an input field via javasrcipt

regards

Alexander

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 12, 2004 at 02:05 PM

    I use this:

    function getHtmlbElement( pElementId )

    {

    var loDocForms = document.forms;

    for( var i=0; i<loDocForms.length; i++ )

    {

    try

    {

    var funcName = loDocForms<i>.id + "_getHtmlbElementId";

    func = window[funcName];

    var element = eval( func(pElementId) );

    if(element)

    {

    return element;

    }

    }

    catch( ex )

    {

    }

    }

    }

    Cause it could be that there are multiple forms on the current page. The parameter 'elementId' is the id defined on the server.

    Regards,

    Stefan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 12, 2004 at 02:06 PM

    I use this:

    function getHtmlbElement( pElementId )

    {

    var loDocForms = document.forms;

    for( var i=0; i<loDocForms.length; i++ )

    {

    try

    {

    var funcName = loDocForms<i>.id + "_getHtmlbElementId";

    func = window[funcName];

    var element = eval( func(pElementId) );

    if(element)

    {

    return element;

    }

    }

    catch( ex )

    {

    }

    }

    }

    Cause it could be that there are multiple forms on the current page. The parameter 'elementId' is the id defined on the server.

    Regards,

    Stefan

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      thank you very much

      you were right about the multiple forms problem.

      i had to change the "var funcName..." line to

      var funcName=loDocForms [ i ] .id+"_getHtmlbElementId";

      it seems that the forum software will ingnore statements like [ i ] if they are written without spaces.

      regards alexander

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.