IN JSp : How to validate textbox of same name?

Hi..
Im having doubt in jsp & its urgent need for me..help out...
Im having multiple html textbox of same name. Onclicking that textbox
i have to call one JS page that creates calendar window which returns date
to same textbox after selection.
For single textbox, the values returns corretly..for multiple it doesnt return
the value..coz of same name i think..
Code:
<script language="JavaScript" src="CmJavaScript.JS" ></script>
<td class="table-text-tab"><input type=text name=a_date onClick=javascript:showcal('testForm.this.value'); value=<%=rs0.getString(5)%> size=13>
<td class="table-text-tab"><input type=text name=f_date onClick=javascript:showcal('testForm.this.value'); value=<%=rs0.getString(7)%> size=13>
Here showcal is the functionname & testform is the form name.
here this two table data will be looped till the end of record selection.
for example if i select 2 records in previous page..this code will be executed twice & will display textbox twice with same name..
ie
a_date ------------ f_date -----------
a_date ------------ f_date -----------
if i click first a_date textbox it populates calendar thru JS which returns date.
bcoz of same textbox name..it doesnt returns the value...
i mean its confused where to return whether in 1st (r) 2nd textbox?

The same rule applies for textboxes as for checkboxes with the same name - indeed for any components accessed in the dom via javascript.
If there is only one element of that name, it is accessed directly.
If there is more than one element of that name, it reveals them as an array.
so document.testForm.a_date would return an array of input fiels
document.testForm.a_date[0], document.testForm.a_date[1] ... document.testForm.a_date[n]
However the order of submission of parameters is NOT guarunteed, which is why people normally DON'T have fields in this manner - because you can't know for certain that a_date[1] matches with b_date[1] at the server end.
The common practice is to give each field a unique name (numbered).

Similar Messages

  • How i validate textbox with dynamic name?.

    My form got a dynamic textbox, it may be 0 or 1 or ....10 in
    the form based on user action.
    Before submitting the form, i want to make sure user enter
    value for all textboxs.
    How can i validate the text box?.
    textbox name item_val_#i#
    item_val_1
    item_val_n
    item_val_ may not be present if user is not adding item_val_
    textbox.
    Please send me validation javascript.

    @javagene:
    there are so many things wrong with your code that i am not
    even going
    to bother with listing the errors, especially since Grizzly
    has already
    done such a nice job of it
    just some advice:
    learn the basics, man/woman!
    the code works fine if - just re-write it correctly! i have
    tested it.
    fix all the syntax and logic errors you have in your code and
    it will work.
    tip: learn the syntax/rules of javascript and how call js
    functions from
    element events
    and learn how to nest quotes properly
    and also learn some cf basics, especially the
    <cfoutput> tag...
    and fix your cfif/cfelse logic if you want to see any text
    boxes on the
    page, never mind in increased numbers...
    and while we are at it, learn to read and try out the replies
    to your
    posts instead of just repeating your question / pleading for
    help again
    and again in hope of someone getting tired of it and posting
    the whole
    complete code for you...
    @ian:
    totally agree with your point. now, where do i send my
    invoice to?..

  • Topic: How to refer columns with same name in jdbc

    I have a join statement :
    Select a.col1, a.col2, b.col3, b.col2 from TABLE1 a, TABLE2 b where a.col1 = b.col1
    how do I refer with same column name suppose I want to get b.col2
    I get error when I try rs.getString("b.col2") or
    rs.getString("TABLE2.COL2")..
    note I donot want positional retrieval i.e rs.getString(x) , where x is column number.
    can you suggest how to refer the b.col2 uniquely.

    Select a.col1, a.col2, b.col3, b.col2 from TABLE1 a,
    TABLE2 b where a.col1 = b.col1You can use a column alias, like below. They "as" keyword isn't always necessary, depends on your database.
    Select
        a.col1 as a_col1,
        a.col2 as a_col2,
        b.col3 as b_col3,
        b.col2 as b_col2
    from
        TABLE1 a,
        TABLE2 b
    where
        a.col1 = b.col1

  • How to reference objects with same name?

    Probably another easy one, but again, couldn't find the answer in old discussions...
    I have some objects with the same name on my form. Designer has made them unique by making an array out of them...object[0], object[1], object[2] etc. How can I reference the individual objects in javascript?  I tried the obvious by referencing them as an array, but to no avail.  I suppose it'd be just as easy, if not better, to just have unique names, but in this case, the objects are related and having them in an array would be handy.

    You can try like below.
         var oObject = xfa.resolveNode("Object[1]");
         xfa.host.messageBox("" + oObject.rawValue);
    Thanks
    Srini

  • How to send File with Same name to Receiver

    HI Frnds,
    In my peoject i have one scenario,
    I have to access Orders is the name of file , available in FTP Server, i have to send same file to Receiver side with same name Orders
    Is it possible with same name dynamically??
    Regards,
    Raj

    hi,
    You have to go for variable substitution option available in receiver file adapter,but for that you have to get the file name in receiver payload.
    http://help.sap.com/saphelp_NW04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm
    these links are  also helpful
    /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
    /people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii
    /people/sriram.vasudevan3/blog/2005/11/21/effective-xsl-for-multimapping-getting-source-filenames-in-legacy-legacy-scenarios
    regards,
    ujjwal kumar

  • How to create directories with same name in different schemas

    I have two schemas on the same database.
    I am trying to create directories with same name, but different paths in both the schemas.
    When i created the directories in second schema, the directory paths of the first schema are automatically changed to the second path.
    Is there any solution to create directories with same name, but different path in two different schemas on the same database.
    Thanks,
    Sridhar.

    Hi,
    >>When i created the directories in second schema, the directory paths of the first schema are automatically changed to the second path.
    If you have removed the REPLACE clause of your create statement, then you would see that is not possible.
    SYSTEM> connect scott/tiger
    Connected.
    SCOTT> create directory mydir as '/tmp';
    Directory created.
    SCOTT> connect legatti/pwd
    Connected.
    LEGATTI> create directory mydir as '/tmp';
    create directory mydir as '/tmp'
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    LEGATTI> select owner,object_name,object_type,created
      2  from dba_objects where object_name='MYDIR';
    OWNER     OBJECT_NAME    OBJECT_TYPE         CREATED
    SYS       MYDIR          DIRECTORY           19/12/2007Cheers
    Legatti

  • Capturing Data of Multiple textbox with same name

    HI,
    I have a table composed on View Object. I am displaying two attributes (Description, name) of that VO. The VO returns 11 rows thus displaying 11 textboxes. On Controller side i need to update the values of these textboxes to database. Can anyone help me out how can i achieve this.
    Thanks in advance.

    Hi,
    in order to do DML operation on DB tables, you should define first "Entity Objects" and then the VO should be based on the EO.
    In this way when you update the value related to the VO they are setted for the EO and then in the DB tables.
    See at "OA Framework Developer's Guide" Chapter 3.
    Bye
    Raffy

  • How to import XSD with same name

    Hi,
    I have a Parent XSD which imports 3 XSD's.
    The parents XSD name and one of the imported XSD name is same in the XSD.
    Say for Ex: 1.xsd is a parent
    which import 2.xsd , 3.xsd & 1.xsd ( from different directory - import path in the XSD is different - <xsd:import namespace="www.localdomain.com/1.xsd" schemaLocation="C:/container/path/1.xsd"/>
    where as the parent 1.xsd is in c:/jms/path/1.xsd
    So whenever i import into the workshop it is giving me compilation error.
    How to fix this ? pls help.
    Thanks,
    -Raj..

    You can try like below.
         var oObject = xfa.resolveNode("Object[1]");
         xfa.host.messageBox("" + oObject.rawValue);
    Thanks
    Srini

  • How to validate for a table name and field name parameters ?

    Dear techies,
                      Kindly help me in validating two parameters.
    1) table name (Date element = CDTABNAME ).
    2) field name  (Data Element = FIELDNAME ).
    I need to know the master table which can be used to validate both the fields..........
    regards,
    Prasannakumar

    You can validate it from table DD03L.
    <REMOVED BY MODERATOR>
    Thanks,
    Srinivas
    Edited by: Alvaro Tejada Galindo on Feb 26, 2008 2:02 PM

  • How to differentiate tags with same name/different attributes using JDOM?

    Hello,
    If I have the following xml file:
    <level1>
    <level2 att="a1">first</level2>
    <level2 att="a2">second</level2>
    <level2 att="a3">third</level2>
    </level1>
    how do I distinguish them from each other and add another attribute to each element?
    <level1>
    <level2 att="a1" insert="s1">first</level2>
    <level2 att="a2" insert="s2">second</level2>
    <level2 att="a3" insert="s3">third</level2>
    </level1>
    regrads,
    Happy New Year!

    Document document;
    NodeList nodeList=document.getElementsByTagName("level2");
            for(int i=0; i<nodeList.getLength(); i++){        
              if(((Element)(nodeList.item(i)).getAttribute("att")).equals("a1"))      
                ((Element)(nodeList.item(i))).setAttribute("insert","s1");  
              if(((Element)(nodeList.item(i)).getAttribute("att")).equals("a2"))      
                ((Element)(nodeList.item(i))).setAttribute("insert","s2"); 
              if(((Element)(nodeList.item(i)).getAttribute("att")).equals("a3"))      
                ((Element)(nodeList.item(i))).setAttribute("insert","s3"); 

  • How to validate a session object in jsp?

    Hi All,
    i am facing a problem.The problem is how to validate the session object object in jsp.I have written a java script by using a defined function as setInterval and has given 5 mintues if the user is idle and will show a pop up menu before time out the session but in case of page active still this pop up menu is coming. The java script as follows.
    function SetTimer(){
         //How long before timeout (should be a few minutes before your server's timeout
         //set timer to call function to confirm update
         if(timeoutMinutes)
         timerObj = setInterval("ConfirmUpdate()",60000);
    function clearTimerFn(){
              timerCount = 0;
              clearInterval(timerObj);
              //timerObj = setInterval("ConfirmUpdate()",60000);
    function ConfirmUpdate(){
         //Ask them to extend
         if(confirm("Your session is about to expire. Press 'OK' to renew your session.")){
              //load server side page if ok
              var url = "ajaxSessionchecker.do?sessionvalidate=sessionvalid";
              LoadXMLDoc(url);
    And in jsp i am calling this js function as
    <%session=request.getSession(false);
              if(session.getLastAccessedTime()==60000){ %>
              <script type="text/JavaScript">
         clearTimerFn();
    </script>
    <%}else{
    session.setMaxInactiveInterval(-1000);} %>
    could you pls help me out?

    The reason for doing this is when ever i come to this user.jsp from account.jsp with a different account number this user.jsp is not refreshed and i still
    see the same old user.jsp for the previous account that i naviated before. Also please let me know if there is any other approach to acheive this taskDoes refreshing the page by pushing F5 solve the problem?
    If so, then the browser is caching the page, despite your attempts to stop it.

  • How to validate multiple lines which is exist in the form builder at the same session

    Hi All,
    we are working on oracle Forms personalization to trigger the message at the point of saving multiple lines rather than requiring each line to be save individually. Currently the oracle form is allowing to user to enter two distinct lines that have same resource and basis type in BOM.
    Currently the Oracle form is allowing to enter the duplicate combination and not giving any error message even we enter the same combination of data.
    As per the customer requirement, they don’t want to validate the data while creating the records but when they try to save the form, in that case it should validate all the records at a time then need to display the appropriate message.
    Customer don’t want to customize the Oracle standard form. Here we have only option to use form personalization or through custom.pll.
    Any idea on how to validate multiple lines which is exist in the form builder at the same session as before inserting the record itself need to perform the validations for all the records.
    Thanks for your help in this regard.
    Regards,
    Thirupathi

    you can write a post script which will do the necessary tasks.
    I mean, once you are done with inserting records into these tables, exeute another procedure which will insert these "extra" records, based on some logic.
    you may not be able use DB trigger as it may generate mutating error or if you don't write it carefully, it will go into recursive loops as you are refering to same tables.
    HTH

  • Same as PHP Functionality In JSP, HOw?

    Hi,
    I am a developer having experiance in PHP with Oracle, I recently have projects to develop in JSP, I want know does JSP also have the Variable in Variable functioanlity in as it's available in PHP?
    In php I stored my variable name in a PHP variable as
    $Asif='My Name is Asif';
    $a='Asif';
    Echo "Here we can get the result of variable Asif using variable a: ".$$a;
    in the above by using $$ it understand the inside value is the actual variable name whose value is to print..
    I need same functionality in JSP.....
    if Any one can help...
    THanks in Advance.
    Asif

    The same rule applies for textboxes as for checkboxes with the same name - indeed for any components accessed in the dom via javascript.
    If there is only one element of that name, it is accessed directly.
    If there is more than one element of that name, it reveals them as an array.
    so document.testForm.a_date would return an array of input fiels
    document.testForm.a_date[0], document.testForm.a_date[1] ... document.testForm.a_date[n]
    However the order of submission of parameters is NOT guarunteed, which is why people normally DON'T have fields in this manner - because you can't know for certain that a_date[1] matches with b_date[1] at the server end.
    The common practice is to give each field a unique name (numbered).

  • How do I validate textboxes in a datasource, windows form, c#

    You could use your validation code at the textbox TextChanged event so before someone presses the button the validation will happen.. In case user doesn't change the textbox and remains empty or the default value you have you can write an if statement before the try block on the button click event "raising" error and showing the relevant message to the user..Especially for the "Student Type" in case that the types are explicitly defined and the user has to choose among some values you could use combobox instead of textbox. At the combobox drop down event you could fill the combo list of values as shown on the example below.
    Of course again you could validate for no value selected with an easy if statement before the try block on the button click event..
    cbosttype.Items.Clear(); cbosttype.Items.Add("Type 1"); ...

    What is the easiest way to validate textboxes that need to be checked before they go through. I have 2 tables I have to insert my data into as well and that's just for one group, in total I have 3 groups but just a helpful tip towards the one will be fine.It needs to be checked before it runs so how would I do it before the try/catch block and still just use the one button click.I have the main table which is 'Person' and then 3 sub tables; 'Student', 'Teacher', 'Administration'.Not all the textboxes need to be validated. sAdd2.Text and StudentType.Text.My normal code isprivate void sNew_Click(object sender, EventArgs e) { try { personTableAdapter.Insert(sFirstName.Text, sSurname.Text, Convert.ToDateTime(sDoB.Text), sPhone.Text, sAdd1.Text, sAdd2.Text, sSuburb.Text, sState.Text, sPostcode.Text, StudentType.Text); ...
    This topic first appeared in the Spiceworks Community

  • Help on jsp code to display data in same page using using ajax ?

    Is there any jsp code to display in same page using using ajax ?

    Re: need help on how to display data in same jsp page. Locking.

Maybe you are looking for

  • Accessing tables from java

    I am creating an inventory system. I have used Java for front-end where i have created forms which display the vendor table, customer table, item table, order table, invoice tbl etc. I have created class files for each form that im displaying. i have

  • Timing mismatch in meeting request

    Hi, I am booking a meeting in my local time zone but the accceptance response (mail) from the meeting room is showing the time in US central time zone. i have checked my local machine time , outlook time and OWA time zone ...everything is fine. Any i

  • Standard and 1:1 preview where are they saved?

    Hi, I searched the forum but I could not find where the standard size and 1:1 preview are saved. Do you know where they are stored? I just need to get an idea of how much space a single 1:1 preview takes up on my disk to allocate the cache. Thanks

  • How can i show a bitmap relative to mouse coordination

    hi I want to show a image (bitmap) and i want him to move with the mouse. I'm use "GetRelativeMouseState" to get coordinations of the mouse and i want that the image will move by the coordinations. Ther is a function that can do this? 

  • Extending enums during runtime

    Hey folks, i have a question concerning enums. Is it possible to extend enums during runtime? For example i have following enum: public enum MyValues VALUE1, VALUE2, VALUE3 }is it possible that i have a method for example which adds VALUE4 and VALUE5