Problem in getting the TextBox object to Javascript....

Hi All,
Below is the code which i'm using to calculate the percentage and amount(vice versa).
<script language="JavaScript" type="text/JavaScript">
function fillAmt(obj) {
alert(obj.name);
var mks_Val = document.billingCycleDistribution.mks0.value;
var obj_Name = obj.name;
var obj_Val = obj.value;
obj_Name = obj_Name.substr(7);
var disp_Amt = (mks_Val * obj_Val) / 100;
var txt = "amount"+obj_Name;
alert("TXT "+txt);
document.billingCycleDistribution.txt.value = disp_Amt;
//alert(obj_Name);
//alert(document.billingCycleDistribution.mks0.value);
//alert(document.billingCycleDistribution.mks1.value);
//document.billingCycleDistribution.mks0.value
</script>
<%
Calendar cal = Calendar.getInstance();
int max_Days = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
for(int rowCount=1; rowCount <= max_Days; rowCount++)
{ %>
<tr>
                              <td width="57" height="27" align="center" class="ms-formlabel" style="border-style: solid; border-width: 1">
                              <p align="center"><input type="checkbox" name= "C1" value=<%=rowCount%>> <%=rowCount%></td>
                              <%
                              for(int txt_box = 0; txt_box < marketSegList.size(); txt_box++) {
                              %>
                                   <td width="153" height="27" align="center" style="border-style: solid; border-width: 1">
                              <div id= <%="percentdiv"+rowCount%> style="display:block"><p align="center">
                                   <input type="text" name=<%="percent"+rowCount+txt_box%> size="15" onblur="fillAmt(this)">
                                   </div>
                                   </td>
<td width="153" height="27" align="center" style="border-style: solid; border-width: 1">
                              <div id= <%="amountdiv"+rowCount%> style="display:block"><p align="center">
                                   <input type="text" name=<%="amount"+rowCount+txt_box%> size="15" onblur="fillPer(this)">
                                   </div>
                                   </td>
                              <%
                              %>
When i try to set the value in amount if a percentage is entered, it gives me an error.
The problem is since both the text fields are named dynamically @ runtime I'm unable to get them in the Javascript function.
Kindly help me out in this.
Thanks
ss

Hi Annie,
Thanks for your reply. I found a method which can be used to set the values.
It is eval(). Here is the code.
Working Code:
eval("document.billingCycleDistribution."+txt+".value = disp_Amt;");
Not Working Code:
document.billingCycleDistribution."+txt+".value = disp_Amt;
Cheers
Srini

Similar Messages

  • Problem in getting the Date object based on the TimeZone

    Hi,
    I need to create a Date object that holds the time of the specified TimeZone.
    I am using TimeZone and Calendar object for that, but when I call the Calendar object's getTime() method, it returns
    a Date object that holds the local time.
    Can somebody let me know what why?
    Here is what I uses in my code.
    TimeZone tz = TimeZone.getTimeZone("IST");
    Calendar cal = new GregorianCalendar(tz);
    System.out.println("Date of "IST" TimeZone = " + cal.getTime());
    Instead of cal.getTime, if I do the following I am getting the values correctly.
    int month = cal.get(Calendar.MONTH); // 0..11
    int day = cal.get(Calendar.DATE); // 0..11
    int hour12 = cal.get(Calendar.HOUR); // 0..11
    int minutes = cal.get(Calendar.MINUTE); // 0..59
    Can somebody let me know why I am not able to assign the Date of the TimeZone specified.
    Is there anything wrong with the code?
    Seb

    Is there anything wrong with the code?No, only with your understanding of the Date class. From the API:
    The class Date represents a specific instant in time, with millisecond precision.
    The different time displayed for different TimeZones around the world are just that: a display format for the same instant in time.
    To display the "instant in time" in a different TimeZone, use DateFormat. Here's a small sample:TimeZone tz = TimeZone.getTimeZone ("GMT");
    Calendar c = Calendar.getInstance (tz);
    System.out.println(c.getTime ()); // prints Tue Mar 18 02:56:53 IST 2008
    DateFormat dtf = DateFormat.getTimeInstance ();
    dtf.setTimeZone (tz);
    System.out.println(dtf.format (c.getTime ())); // prints 9:26:53 PMIt's no different from formatting the same number in various ways: 10 decimal == 0xA hexadecimal == 012 octal == 1010 binary. Same value, different representation. Same intant in time, different local time for each zone.
    Savvy?
    cheers, db

  • Problem in getting the frame object in firefox 20.0.1

    When i upgraded to firefox 20.0.1 which have throw exception in javascript.
    I am using a lightstramer 3.6 library for my development.
    Program cause error by use this object.
    "var masterWinRef = self.parent.frames["push_engine"]"
    When I change this line to
    "var masterWinRef = top.document.getElementById('push_engine').contentWindow ;"
    So, what is the different between this?
    Before use firefox 19 is working.

    Is there anything wrong with the code?No, only with your understanding of the Date class. From the API:
    The class Date represents a specific instant in time, with millisecond precision.
    The different time displayed for different TimeZones around the world are just that: a display format for the same instant in time.
    To display the "instant in time" in a different TimeZone, use DateFormat. Here's a small sample:TimeZone tz = TimeZone.getTimeZone ("GMT");
    Calendar c = Calendar.getInstance (tz);
    System.out.println(c.getTime ()); // prints Tue Mar 18 02:56:53 IST 2008
    DateFormat dtf = DateFormat.getTimeInstance ();
    dtf.setTimeZone (tz);
    System.out.println(dtf.format (c.getTime ())); // prints 9:26:53 PMIt's no different from formatting the same number in various ways: 10 decimal == 0xA hexadecimal == 012 octal == 1010 binary. Same value, different representation. Same intant in time, different local time for each zone.
    Savvy?
    cheers, db

  • Problem in getting the function template object from the repository.

    Hi all,
    I have created a par file. I have a JCO connection in that. I am facing problems in getting the function template object from the repository. This thing is running successfully when i try to deploy it in Tomcat. But i am facing problems when i try to deploy it in SAP EP 6.0.
    Below is statement which is giving error after being deployed to SAP EP6.
    This is executing fine when executed in Tomcat Server.
    // getting the object of function template
    IFunctionTemplate functionTemplate =
    aRepository.getFunctionTemplate("YADDNEWUSER");
    Note : YADDNEWUSER is the name of the RFC which I am calling from my JAVA Code.
    Thanks in advance,
    Divija

    This sounds like a bug in the smart upload code. I have used this stuff before, but it's probably an older version, so maybe they broke something. Enumerations aren't usually guaranteed to keep things in any particular order. I would say for now, make a method to take the enumeration and a param name to find the value. And write to the JSPSmart people.

  • Problem getting the collection objects in Toplinks using JDeveloper11g

    Hi All
    I am working the Toplinks in JDeveloper11g. I am using the Java Objects From Tables to create the Toplink map .
    The problem is I am unable to work with the collection objects. I am getting the collection objects like addtocollection and removefromcollection. when I am dragging the collection object into the form and running the application it is giving errors.
    Can any one help me out how to work with this collection objects.
    Thanks in advance
    Madhavi.

    look at the java.util.SortedMap interface, and the classes that implement it. or, re-think your design. why do you want the entries sorted? do you really want that, or do you assume you do? is a Map the right collection here? I'm not saying it isn't, I'm just saying that the sorting requirement sounds like an assumption you need to challenge. generally, we get data out of a Map by explicitly asking for it by key

  • How to I get access to the Captivate object in javascript within an HTML file?

    I'm still struggling with this and would really appreciate any help/guidance you can .
    here's what I've got right now:
    var g_bIsInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
    document.write("<P><H1> g_bIsInternetExplorer=" + g_bIsInternetExplorer + "</H1></P>");
    document.write("<P><H1> setting objCP....</H1></P>");
    var objCp = g_bIsInternetExplorer ? Captivate : document.Captivate;
    document.write("<P><H1> set objCP....</H1></P>");
    var description = objCp.cpEIGetValue("m_VarHandle.cpInfoDescription");
    document.write("<P><H1> description=" + description + "</H1></P>");
    I've published the captivate project.. I then launch it and then launch the html file that has this code in it
    It does everyting up thru and including line 3
    But it seems to fail on line 4..
    Any ideas /suggestions?
    Thanks in advance.

    Hey Jim - thank you thank you thank you
    Here's what was up with my code:
    This worked:
    alert("about to set objCP...");
    var objCp = document.Captivate;
    alert("completed setting of objCP, about to set get cpInfoDescription...");
    var description = objCp.cpEIGetValue("m_VarHandle.cpInfoDescription");
    alert("description=" + description);
    This did NOT work:
    document.write("<P><H1> AT BEGINNING </H1></P>");
    alert("about to set objCP...");
    var objCp = document.Captivate;
    alert("completed setting of objCP, about to set get cpInfoDescription...");
    var description = objCp.cpEIGetValue("m_VarHandle.cpInfoDescription");
    alert("description=" + description);
    ====
    I'm guessing the 2nd didn't work because i tried to get the captivate object AFTER the script wrote something to an HTML file.  I'm ultimately trying to get Captivate to generate a report for the user to report out what they did in response to the various quiz questions in the course (in HTML in table).   I've posted a query on how to do this here: http://forums.adobe.com/message/5120417#5120417
    Any chance you could take a look at this posting and let me know your thoughts on how best to do this .. It seems like this would be a fairly common thing to do .. It comes stock in Articulate Storyline (through their 'Report.HTML') but I haven't found a comparable one in Captivate.
    Thanks again!
    tom.

  • Is there inbuild Handler in weblogic using which i can get the MessageContext object

    HI,
    I need MessageContext object in my application but i dont want to use the Handler,As
    there is AxisEngine in axis soap engine,is there any similar implementation in
    weblogic.
    AxisEngine.getCurrentMessageContext() we can get the MessageContext what about
    in weblogic..any body any idea???
    Regards,
    Akhil Nagpal

    HI,
    yeah i had to make use of Handler to get the MessageContext object and play with
    that.
    Thanks & Regards
    Akhil Nagpal
    "manoj cheenath" <[email protected]> wrote:
    You can get to MessageContext from a handler. Check out an example of
    handler
    to see how you can get Message out of MessageContext.
    -manoj
    "Akhil Nagpal" <[email protected]> wrote in message
    news:[email protected]..
    HI manoj,
    Thanks for your reply.otherwise i thought that i wont get any morehelp
    on this
    forum :-) ...
    anyway its good that we will have such thing in next version,duringthe
    development
    i feel that more functioanlity should be in build in appserver. Likeone
    more
    thing i could not find out is how we can get the "message" object inweblogic
    like we can in axis using its MessageContext class's static method.if it
    is there
    can you please let me knwo about that.
    The other problem i had to make use of handler and my appl is workingas of
    now :-)
    Regards
    Akhil Nagpal
    "manoj cheenath" <[email protected]> wrote:
    You can not do this in WLS 7.0. The next major release (WLS 8.1) will
    fix
    this problem.
    -manoj
    "Akhil Nagpal" <[email protected]> wrote in message
    news:[email protected]..
    HI,
    I need MessageContext object in my application but i dont want
    to
    use
    the Handler,As
    there is AxisEngine in axis soap engine,is there any similarimplementation in
    weblogic.
    AxisEngine.getCurrentMessageContext() we can get the MessageContextwhat
    about
    in weblogic..any body any idea???
    Regards,
    Akhil Nagpal

  • Problem in getting the database connection from a connection pool

    Hai All,
    I am facing a problem in getting the database connection from a connection pool created on weblogic server 8.1.
    I am using the Oracle database 8.1.7.
    I have configured my connection pool, datasource and JNDI in weblogic.
    In my java program i have the following code to retrieve the connection.
    import java.sql.*;    
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    class jdbcshp1 {
        public static void main(String[] args) {
         Connection connection = null;
         try {
               Hashtable ht = new Hashtable();
               ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");  // Wanna get rid of this.
               ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); // wanna get rid of this.
               // Get a context for the JNDI look up
               Context ctx = new InitialContext(ht);
            javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myjndi1");
              //Create a connection object
              connection = ds.getConnection();
         The above code is working fine but, the two ht.put statements are creating problem.
    The problem is, after converting the application into WAR file it can be deployed
    on any machine or different port on same machine. My application fails if its deployed on
    weglogicserver which is at different port.
    Is there any way that i can get rid of those ht.put statements or any other way to solve the problem.
    any help is appreciated.
    Thanks in advance
    Pooja.

    Hai All,
    Firstly, thanks for ur reply.
    Even i have seen some code which uses context constructor with out any parameter and works fine.
    i dont understand why its not working for my code.
    When i remove those ht.put code and use context constructor with out any parameter, it giving an error.
    Context ctx = new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("ocjndi");
    connection = ds.getConnection();The error is as follows:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    the above error is forcing me to include those code but if the port number is changed the code will not work. Plz let meknow if some setting have to be made.
    I appreciate all ur valuable help.
    Thanks once again.
    Pooja.

  • To get a datatable object in javascript

    How do i get a datatable object in javascript?
    <html:dataTable id="tabData"/>
    i use document.getElementById("tabdata"); to get the data table object in javascript I get an error..
    How do I do this?

    You have to put the complete path to the datatable.
    ex:
    If you have a form then the datatable:
    document.getElementById('form1:dataTable');

  • IBM WSAD 4.0.3 - getting the DataSource object

    Hi guys , i had posted a DataSource question before...but i was able to figure that out. My new problem is that i cant get the DataSource object in my java program and the following error is thrown.
    java.lang.NoClassDefFoundError: com/ibm/ejs/ras/TraceElement
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:212)
         at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:656)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.InitialContext.<init>(InitialContext.java:199)
         at DataSourceCheck.main(DataSourceCheck.java:27)
    Exception in thread "main"
    Here is my Java program :
    import java.sql.*;
    import javax.naming.*;
    import java.util.*;
    class DataSourceCheck
         public static void main(String[] args)
              javax.sql.DataSource myDataSource= null;
              try
                   String initialContextFactory = "com.ibm.websphere.naming.WsnInitialContextFactory";
                   String providerURL = "iiop://localhost:8081";
                   java.util.Properties props = new java.util.Properties();
                   props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
                   props.put(Context.PROVIDER_URL, providerURL);
                   Context myContext = new InitialContext(props);
                   Connection myConnection = myDataSource.getConnection();     
              catch (Exception e)
                   e.printStackTrace();
                   System.out.println();
    I start a Server instance from IBM WSAD and it runs on 8081.
    Please suggest what to do .

    sorry..i forgot to delete that line...its a typing eror.
    Here is the code again....
    I fail to get the context.
    import java.sql.*;
    import javax.naming.*;
    import java.util.*;
    class DataSourceCheck
         public static void main(String[] args)
              javax.sql.DataSource myDataSource= null;
              try
                   String initialContextFactory = "com.ibm.websphere.naming.WsnInitialContextFactory";
                   String providerURL = "iiop://localhost:900";
                   java.util.Properties props = new java.util.Properties();
                   props.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
                   props.put(Context.PROVIDER_URL, providerURL);
                   Context myContext = new InitialContext(props);
                   //myDataSource = (javax.sql.DataSource)myContext.lookup("jdbc/oracle/OracleDataSource");
                   //Connection myConnection = myDataSource.getConnection();     
              catch (Exception e)
                   e.printStackTrace();
                   System.out.println();

  • How to get the value from a JavaScript and send the same to Java file?

    Hi.
    How to get the value from a JavaScript (this JS is called when an action invoked) and send the value from the JS to a Java file?
    Thanks and regards,
    Leslie V

    Yes, I am trying with web application.
    In the below code, a variable 'message' carries the needed info. I would like to send this 'message' variable with the 'request'.
    How to send this 'message' with and to the 'request'?
    Thanks for the help :-)
    The actual JS code is:
    function productdeselection()
    var i=0;
    var j=0;
    var deselectedproduct = new Array(5);
    var message = "Are you sure to delete Product ";
    mvi=document.forms[0].MVI;
    mei=document.forms[0].MEI;
    lpi=document.forms[0].LPI;
    if(null != mvi)
    ++i;
    if(null != mei )
    ++i;
    if(null != lpi)
    ++i;
    if(null != mvi && mvi.checked)
    deselectedproduct[++j]="MVI?";
    if(null != mei && mei.checked)
    deselectedproduct[++j]="GAP?";
    if(null != lpi && lpi.checked)
    deselectedproduct[++j]="LPI?";
    if( 0!=j)
    if(i!=j)
    for (x=0; x<deselectedproduct.length; x++)
    if(null != deselectedproduct[x])
    message =message+ "-" +deselectedproduct[x];
    alert(message);
    else
    //alert(" You cannot remove all products!");
    return false;
    return true;
    }

  • How can I get the underlying object from the ObjectReference

    Dear friends,
    I think this question has been asked a couple of times. But, I am still wondering if anybody has found an answer to it. Maybe this is some common need ...
    I would like to get the underlying object for which the ObjectReference is
    a mirror For example, I have a class Customer in my application, and I can get an ObjectReference through JDI during runtime. But how can I get the target VM's object which is a real instance of Customer, by which I can invoke methods defined in Customer?
    Thank you so much for any input!
    SunnyDay

    I'll preface this response by admitting this far from an elegant solution, but I did write a function addressing this question, mostly as an exercise.
    If passed an object with an InTextFrame property (Pgf, AFrame, Cell, Fn) that resides in an open document, the function will return the Doc object. Otherwise, it returns undefined.
    function getParentDoc(testObj) {
        //Get object for current page
        try { var curPage = testObj.InTextFrame.FrameParent.PageFramePage; }
        catch(er) {return;}
        //Step backwards to first page in document
        var prevPage = curPage.PagePrev;
        while (prevPage.ObjectValid())
            curPage = prevPage;
            prevPage = prevPage.PagePrev;
        //Compare with first pages of open documents
        var testDoc = app.FirstOpenDoc;
        while (testDoc.ObjectValid())
            if (curPage.id==testDoc.FirstBodyPageInDoc.id) return testDoc;
            testDoc = testDoc.NextOpenDocInSession;    
        return;
    To your PPS: Rather than seeing the native framework grow bloated to address additional features, I would love to see Adobe and other developers publish libraries of useful functions and class extensions.

  • How to get the UserTransaction object in  stateless session bean

    Hi, I am using jboss server and jdk5 version and using EJB.
    My Application flow :
    JSP à Action(Struts) à Service Locator à Session bean à Entity Bean(cmp) à DB.
    I tried to get the UserTransaction object in my Action. Its my code.
    InitialContext ctx = new InitialContext();
    UserTransaction uTrans = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
    After used uTrans.begin(),uTrans.commit() and uTrans. rollback () also.
    Its working fine .
    But, I used the the same code inside in my session bean its not working.
    Stateless Session Manager Bean code :
    public class SampleManagerBean implements SessionBean {
    public void ejbCreate() throws CreateException {  }
    public void ejbRemove() {  }
    public void ejbActivate() {   }
    public void ejbPassivate() {   }
    public void setSessionContext(SessionContext sessionContext) {
    this.sessionContext = sessionContext;
         public void createSample() throws EJBException
         try{
                   InitialContext ctx = new InitialContext();
                   UserTransaction ut = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
              }catch(Exception e) {
              System.out.println(“ Exception === > “+e)
    Its throws the error ie: javax.naming.NameNotFoundException: UserTransaction not bound
    How to get the UserTransaction object in my session bean. Kindly give solution the above errors.
    - Thendral

    first of all, you could just use sessionContext.getUserTransaction(). however, that would only work if your bean is using bean-managed transactions. the default is container-managed transaction, in which case you cannot get a UserTransaction object. if you want to manage transactions, you need to add the TransactionManagementType.BEAN annotation to your ejb.

  • How to get the view Object in UserDefined Action

    Hi  All,
       Any body tell me how to get the view object , like the view object avilable in the wdDoModifyView() method as parameter.
    I have requirement like, i want to change the , no of rows displaying in the table should be changed at the runtime based onthe no of rows  selected in the dropdown box.
    The action which i created will be assigned to that dropdown box, on select of the available option, i will get the view object and change the properties of the "maxrows" of the table .
    so for getting the view object in the  the Action methods tell me what is the procedure for getting the current view object.

    Hello Vishal,
    Simply create a value attribute (say rowCount) of type 'integer' and bind it to the 'visibleRowCount' property of your table. Then, in the actionHandler get the value from the UI element (in your case, I guess it is drop down) and set it to the attribute 'rowCount' like this.
    wdContext.currentContextElement.setRowCount(
        wdContext.current<nodeElement>.set<AttributeBound toDropDown>);
    Bala

  • Unable to get the admin object for the CsContainerAdmin service

    Hi,
    On AIX, we deployed XIR2 SP2 --> XIR2 SP3 --> SP3 Productivity Pack.
    The Conection server does show up on the server list in the CMC, but on trying to access this server, it throws an error" Unable to get the admin object for the CsContainerAdmin service"
    Tried to manually create another Connection server, same result.
    Is this an issue that is addressed by a later FP?
    Thanks in advance
    Rajesh Jayakumar

    Hi Rajesh,
    Were you able to resolve this issue? I am facing the same issue with almost every BOE 11.5 SP3 server on Windows.
    For example, the Input file server says this -
    "Unable to get the admin object for the FileServerAdmin service for server Input.BOCMSMSGT1.fileserver".
    Getting the same error on WebI Report Server as well -
    There was an error while retrieving data from the server: Unable to get the admin object for the WebiServerAdmin service for server BOPROCENG1.Web_IntelligenceReportServer.webiserver
    Thanks,
    Sarang
    Edited by: Sarang Deshpande on Sep 26, 2008 3:08 PM

Maybe you are looking for

  • How can we export the Primary key values (along with other data) from an Advantage database?

    One of our customers is moving from our application (which uses Advantage Database Server) to another application (which uses other database technology). They have asked us to help export their data, so that they can migrate it to another database sy

  • Can I set a default folder for "save as"?

    Hello, I opened a pdf file attachment to an email by double-clicking it. When I wanted to save the file using File/Save As... , the folder/directory shown was the location where MS Outlook placed the attachment. I am using Acrobat Reader XI (latest v

  • Can't update text in JTextArea! Can you help?

    [Update: If I remove the transparency everything is fine. However, I really need the transparency..] Hi, I have the simplest question, but I can't seem to get an answer to it. The problem is very simple: I have defined a JTextArea and I'm reading tex

  • Preview always "thinks" it is opening for the first time...

    When opening images in Preview, it always says that "Open this document will open the application 'Preview' for the first time" - no matter how many times you open/close Preview, restart, trash preferences, etc. Where does OS X keep track of this set

  • Access mobileme account + emails on my mac/me accounts.

    I am unable to access either my mobileme account - via the system preferences or mail nor can I send or receive emails via .mac or .me email accounts. Something happened to my password and unfortunately I cannot retrieve through keychain - the passwo