473,383 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

document.getElementById("starttimeScheduler") returns null

Hi, I am working on a webapplication,( with Ajax & JSF) where I want to retrieve the value present in a
Expand|Select|Wrap|Line Numbers
  1. <t:inputText id="starttimeScheduler"  value="#{scheduledJobCreateEdit.startTimeDate}" style="width:165px; margin-left: 25px;" forceId="true" tabindex="112">  
by using
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("starttimeScheduler") 
in my javascript function. but this is always returning null. The <t:inputText > is present with in a <t:div>. Can you please let me know , how can I get the <t:inputText > value . I have the issue with both FF and IE 7.
Mar 28 '08 #1
3 2335
malav123
217 100+
Hi,
pass the form and use it in java script, and if you are using master page then use the prefix of content place hoder and form your problem will be solved...
Mar 28 '08 #2
Hi,
pass the form and use it in java script, and if you are using master page then use the prefix of content place hoder and form your problem will be solved...
I didnt understand , when you mentioned "pass the form".
THe code I have is :
Expand|Select|Wrap|Line Numbers
  1. function checkScheduledDate()
  2. {
  3.  var scheduledTime = document.getElementById("starttimeScheduler"); 
  4.  if(scheduledTime == null)    
  5.  {
  6.    return false;
  7.  }
  8. }
  9.  
  10. <h:form>
  11. ...
  12. <t:div id="contents_starttime_div" styleClass="contents" style="border:none;">
  13. <t:inputText id="starttimeScheduler"  value="#{scheduledJobCreateEdit.startTimeDate}" style="width:165px; margin-left: 25px;" forceId="true" tabindex="112">
  14. <f:convertDateTime pattern="#{cal['jsfcalendar.pattern']}" locale="#{facesContext.viewRoot.locale.language}"/>
  15. </t:inputText>
.....

Now in my javascript function, I want to retrieve the value present in the input text at the time of form submission. So, I am calling the javascript function on submit, but the function always returns null on document.getElementById().
Please help me out here.
Mar 28 '08 #3
malav123
217 100+
Hi,
you just call the function from submit button like,
Expand|Select|Wrap|Line Numbers
  1.  Btn.Attributes.Add("onClick", "return yourfunction(this.form)")
and in your javascript use simply,
Expand|Select|Wrap|Line Numbers
  1. yourfunction(f)
  2. {
  3.          if(f.starttimeScheduler=="")
  4.                            alert("message");
  5. }
  6.  
now it will work fine for u.....
Mar 31 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rene van Hoek | last post by:
Hi, I am using Xalan 1.8.0 and Xerces 2.6.0 in C++. I have an XML document which I first transform into an other XML document using an XSL styelsheet. Then I want to parse with XPathEvaluator...
1
by: Suresh | last post by:
Hi, I have an C# CSEXE.exe (CSexe.cs) and a CSDll.dll (CSdll.cs). exe is compiled with a reference to dll. Calling for the class Type defined in CSDLL.dll using Type.GetType(...
2
by: Jeff Adams | last post by:
I am using MSVC .NET to create a C program. I am having trouble creating a window. The createwindow returns NULL however no error is caught. The GetLastError() returns "operation completed...
1
by: BeckyB00 | last post by:
Slightly different situation from the question of the 11/18/05 but the same error. (I'm just learning about web services so this is based on a 'quick tutorial') I'm running a web service using...
0
by: Zean Smith | last post by:
I am trying to get my C# client to connect to a 3rd Perl Web Service (SOAP Lite), this is the code that fails ...... object results = this.Invoke("getGrossData", new object {week} ); return...
11
by: MLH | last post by:
I have 2 lines in a procedure that assign MyVariant a value - line #238 and line #491. When line #238 runs, the value is 152. When line #491 runs, the DLookup function returns Null. I would expect...
1
by: js | last post by:
I am using the following C# code and T-SQL to get result object from a SQL Server database. When my application runs, the ExecuteScalar returns "10/24/2006 2:00:00 PM" if inserting a duplicated...
3
pragathik
by: pragathik | last post by:
hi, i have a problem with document.body.offsetTop and document.body.offsetLeft always returns null in my code in IE6. how can I get the values???? please suggest
2
by: wizardry | last post by:
hello - i'm trying to insert a blob into my table, it will insert but the string that i insert when i query the inserted data returns null with 0 bytes in the column. I have other tables set...
9
by: ipanos | last post by:
Hey guys... I am not too knowledged in js and I code in it occasionally, so please excuse the question if it is steight forward... Now... Been working on an analogue clock script, customised...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.