JavaScript Date Question ??

Hi -
I am using Portal 3.0.9. I have a form with field "A" which is date type defaulted to sysdate.
I have another field "B" which I want to be defaulted to "A+7". I am not a JavaScript Guru.
I would appreciate any help
Thanks in Advance.
Fahim

ok, this is what you need to do:
The onBlur event for A will be called when the textbox A loses focus, so this is where the code should go. "this.value" will give you the value entered in A. The way to reference B is document.forms[0].elements[whatever number B is]
So your code would look something like this:
document.forms[0].elements[11].value=this.value;
Of course you will need some logic to increment the date by 7 days. A search in google got me this: http://javascript.about.com/library/scripts/bldatemath.htm
Hope this works for you,
hsiu

Similar Messages

  • CRM Javascript Date Functions

    Hi all,
      I have a Javascript Date object with the datetime translated from UTC to the current user timestamp, but I need to obtain the day of the week of this datetime according to this timestamp, not according to the local time from the machine and not according
    to UTC. Can anyone help me?
    Thanks,
    David N.

    function checkEstimatedCloseDate() {
    var date = Xrm.Page.getAttribute("estimatedclosedate").getValue();
    if (date != null) {
    var today = new Date();
    var currentDate = today.getDate().toString() + "/" + (today.getMonth() + 1).toString() + "/" + today.getFullYear().toString();
    var dateWithNoTime = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
    if (Xrm.Page.getAttribute("estimatedclosedate").getValue() < dateWithNoTime) {
    alert("Estimated Close Date Cannot Before " + currentDate);
    Xrm.Page.getAttribute("estimatedclosedate").setValue(null);
    event.returnValue = false;
    Regards Faisal

  • Javascript opoup question?

    My question is
    in window.open() if i give resizable=no and scrollbars=no is working fine in IE but not working in mozilla
    anyone can help?
    Thank You,
    Sreenu.G

    gantinapalli wrote:
    even specifying the width and height also it's not workingYou did something wrong.
    This example works in all browsers here:
    <html>
        <head>
            <title>Test</title>
        </head>
        <body>
            <button onclick="window.open('http://google.com', 'test', 'width=500px, height=300px, resizeable=no, scrollbars=no')">test</button>
        </body>
    </html>And in the future please post Javascript related questions at a Javascript forum. This has nothing to do with JSF. There are JS forums at dynamicdrive.com and webdeveloper.com.

  • JSF/ Javascript Date Picker

    Has anyone incorporated a javascript date picker with JSF? if so how did you handle the fact that the inputText for jsf doesn't have a name and is in the form of <h:inputText>? Any help would be appreciated, Thanks.

    Did you look at the ADF Faces Date picker as an option?
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/chooseDate.html
    or
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/selectInputDate.html

  • How to programmatically set formatted javascript dates for validation?

    How does one programmatically set formatted javascript dates for validation?
    "12/31/2011" does not seem to work?

    ourDate.rawValue = "2011-12-31";  // works
    NOTE:  if you have a hierarchy issue you may need something like
    root.body.table.detail.ourDate.rawValue = "2011-12-31";

  • Javascript: data object question

    Hi, I have the following data object. Each string in the "lib" element represents a new record. I need to display each of these records in html table format so I can be able to sort on each column. How can I get each string from each element into its own row, or is there a better way to populate this data object? Thanks.
    var jsData = new Array();
    for (var i = 0; i < 4; i++)
       jsData[jsData.length] = {lib: "string1,string2,string3,string4", id: "num1,num2,num3,num4", com: "string1,string2,string3,string4"};
    }html table output should look like:
    string1 | num1 | string1
    string2 | num2 | string2
    string3 | num3 | string3
    string4 | num4 | string4

    java != javascript
    google javascript forum.

  • Quick Date Question

    I'm working on a system with a lot of date validations. The validations that I built work fine as long as someone uses the correct format. The code that I'm using is:
    DECLARE
    DATE_CHECK DATE;
    DOB_CHECK DATE;
    BEGIN
    BEGIN
    DOB_CHECK := to_date(:P32_DOB, 'MM/DD/YYYY');
    DATE_CHECK := to_date(:P32_DI_UR_DT, 'MM/DD/YYYY');
    IF DOB_CHECK > DATE_CHECK
    THEN
    RETURN 'Urine condition onset date cannot occur before birth date.';
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN 'Urine condition onset date not a valid date.';
    END;
    END;
    Like I said. This works correctly, as long as someone uses the four-digit year. If they only use a two-digit year (08/04/09) it keeps throwing the error that it is occurring before the birth date.
    I have used JavaScript in other programs so that I could automatically format any date that is put in to the format that I want. The problem is that I can't use that functionality in this case because it will create an infinite loop.
    So, my question is this: How can I isolate the year of the date in PL/SQL so that I can add either 19 or 20 to the beginning of the year so that it conforms to the format I'm using?
    Thanks in advance.
    Josh

    I would strongly advise a javascript validation to check the four digit year was supplied.
    However the modified code below adds 19 or 20 to the input year.
    But what if your software will beyond 2100?
    Or what if you have a Dracula patient born before 1900?
    DECLARE
       date_check   DATE;
       dob_check    DATE;
       FUNCTION add_century(p_sdate IN VARCHAR2)
       RETURN VARCHAR2
       IS
       BEGIN
          RETURN CASE WHEN LENGTH(p_sdate )<10
                        THEN CASE WHEN TO_NUMBER(SUBSTR(p_sdate ,-2)) <= TO_NUMBER(TO_CHAR(SYSDATE,'YY'))
                                  THEN  SUBSTR(p_sdate ,1,6)||'20'||SUBSTR(p_sdate ,-2)
                                  ELSE  SUBSTR(p_sdate ,1,6)||'19'||SUBSTR(p_sdate ,-2)
                              END   
                        ELSE p_sdate
                    END;
       END;
    BEGIN
       BEGIN
          dob_check := TO_DATE (add_century(:p32_dob), 'MM/DD/YYYY');
          date_check := TO_DATE (add_century(:p32_di_ur_dt), 'MM/DD/YYYY');
          IF dob_check > date_check
          THEN
            RETURN 'Urine condition onset date cannot occur before birth date.';
          END IF;
       EXCEPTION
          WHEN OTHERS
          THEN
              RETURN 'Urine condition onset date not a valid date.';
       END;
    END;

  • Unlimited Data Questions...

    Hey guys,
    I have a few questions regarding ulimited data on my plan. I am on a plan with one other person. We share at total of 400 anytime minutes. We each have our own UNLIMITED data plans at $30 a month. We had both got Droid 1/Milestones when they came out. A year and some went by and i had recieved a Upgrade card in the mail. I used the card to purchase my Droid RAZR on 11/11/11. I was still enrolled in the UNLIMITED data plan at that point. Unlimited data was nixed as a plan on 11/28/11 which didnt effect me then but it does NOW as i am trying to upgrade to a newer phone due to speed and camera clearity. The person i am on the plan with still has their Droid 1/Milestone and ISN'T planning on upgrading ANYTIME soon. I recently recieved a text saying i could upgrade but would lose data. I use anywhere from 4.6-5.8gb of data a month because i do not have WiFi in my place of work, school, or at home.
    For my questions:
    1.) If i upgrade and renew for 2 years with a new phone i lose my unlimited data, correct?
    2.) If the other person on my contract upgrades and then we switch phones she will lose unlimited as well
         but will that effect my phone number plan?
    3.) I was told that i would be paying $810 total over 18 months if i upgrade to a higher data gb plan because
         it would jump from $30 a month to $75 a month which is $45 more. $45 times 18 months equals $810.
         Would it be more cost effective to BUY a phone at RETAIL and then activate it?
         3a.) Would Verizon charge for that?
         3b.) Would that remove my grandfather?
         3c.) Was the information i recieved from Verizon correct?

    Bawkinator wrote:
    Hey guys,
    For my questions:
    1.) If i upgrade and renew for 2 years with a new phone i lose my unlimited data, correct?
    2.) If the other person on my contract upgrades and then we switch phones she will lose unlimited as well
         but will that effect my phone number plan?
    3.) I was told that i would be paying $810 total over 18 months if i upgrade to a higher data gb plan because
         it would jump from $30 a month to $75 a month which is $45 more. $45 times 18 months equals $810.
         Would it be more cost effective to BUY a phone at RETAIL and then activate it?
         3a.) Would Verizon charge for that?
         3b.) Would that remove my grandfather?
         3c.) Was the information i recieved from Verizon correct?
    1) Yes
    2) Each line has their own contract. You can swap upgrades dates. The person who the upgrade originally belonged to will lose their unlimited data.
    3) Not sure where the 18 months come in since you can only upgrade once every 24 months. The 5 GB plan is $50 a month( or $20 more ) and the 10 GB plan is $80 a month( or $50 more )
    3a) Charge for what? data? More data you use the more it costs. That's how a tiered data plan works.
    3b) because Verizon wants to get people off of unlimited data plans. This policy has been in effect for nearly 11 months now.
    3c) yes and no.

  • 7.9.6.1 Financial Analytics - JDE - Extract Dates question

    Hi all,
    Implementation of 7.9.6.1 Financial Analytics + Procurement and Spend Analytics
    OLTP: JDE E9
    OLAP DB: Oracle 11g
    We were trying to adjust the # of prune days for an incremental load, when we discovered the change was having no effect.
    Our situation - JDE*
    Looking at the parameters in DAC, we found that the incremental condition in the SDEs is:
    date >= *$$LAST_EXTRACT_JDEDATE*
    In DAC, this parameter expands to:
    TO_NUMBER(TO_CHAR(TO_DATE('@DAC_$$TGT_REFRESH_DATE'), 'DDD'))+(TO_NUMBER(TO_CHAR(TO_DATE('@DAC_$$TGT_REFRESH_DATE'), 'YYYY')) -1900) * 1000
    If one keeps digging,
    +$$TGT_REFRESH_DATE = @DAC_TARGET_REFRESH_TIMESTAMP in custom format, MM/DD/YYYY+
    Compared to EBS*
    Now, if I look at the *$$LAST_EXTRACT_DATE* parameter (used in EBS SDEs)
    It expands to:
    +@DAC_SOURCE_PRUNE_REFRESH_TIMESTAMP in custom format, MM/DD/YYYY+
    Conclusion and question*
    Obviously the Julian date conversion is required in $$LAST_EXTRACT_JDEDATE, but apparently the prune days are being considered in $$LAST_EXTRACT_DATE and not in $$LAST_EXTRACT_JDEDATE.
    An obvious fix is to use @DAC_SOURCE_PRUNE_REFRESH_TIMESTAMP in $$LAST_EXTRACT_JDEDATE, but I don't know if that would have any side effects. I'll test it.
    I'll raise a SR with Oracle, but wanted to check if you guys had seen this before.
    Thanks, regards.-
    Alex.-
    Edited by: Alejandro Rosales on Feb 22, 2011 5:57 PM

    Hi Alejandro,
    Maybe this has been updated/correct in 7.9.6.2. Later today I will be in the office and can check in a VM image.
    I'll update the thread as soon as soon as I have checked this out.
    Regards,
    Marco Siliakus

  • Javascript/HTML question

    I've been teaching myself Java on and off for the past couple years with the help of these forums and other tutorials. Now I've decided to take on a project that requires the use of HTML and Javascript and I can't seem to find the information I need. I was hoping that somebody from these forums could either answer my questions and/or point me in the right direction to find the answers.
    The project is simple. I created an HTML window with an inputTextArea, an outputTextArea, and two buttons (Submit and Reset). When Submit is pressed I need the program to take the text from inputTextArea one line at a time, check the indexOf a string, and add tags at the beginning and end of the string if it meets certain criteria before appending it to outputTextArea.
    I can (and have) written this very easily in Java but I can't seem to find the methods I need in Javascript. In java I use a java.io LineReader to read the inputTextArea.getText() one line at a time and then make the changes as needed. I actually can't even find a tutorial in Javascript that can explain how to take the text from inputTextArea and print it into outputTextArea.
    So the main thing I need to know is how to read one line of text at a time from the inputTextArea. I think I can figure the rest out.

    That was actually my original thought when I started on the Java version of the program but I couldn't figure out how to enter the the carriage return in as a variable to be indexed. So it wasn't until after I found the LineReader that I was able to complete the Java version.
    Is there some way to enter the carriage return in as a searchable variable?

  • Unsubsidized Activation and Unlimited Data Question

    I'm currently an AT&T customer, and want to move to Verizon before the tiered data begins. I'd like a 4G phone, but the offerings right now are kind of sparce. So I'm thinking of buying a Droid 2 Global at full cost, and upgrading to the bionic whenever it comes out, but I've got a couple questions:
    1. If I buy an unsubsidized phone and don't need to enter into a 2-year contract, will the unlimited data plan for month-to-month still be active after July 7?
    2. When the Bionic finally comes out, will I be eligible for the subsidized cost? And can I keep the unlimited data for a 2-year contract?
    Thanks!

    SweetJebus wrote:
    I'm currently an AT&T customer, and want to move to Verizon before the tiered data begins. I'd like a 4G phone, but the offerings right now are kind of sparce. So I'm thinking of buying a Droid 2 Global at full cost, and upgrading to the bionic whenever it comes out, but I've got a couple questions:
    1. If I buy an unsubsidized phone and don't need to enter into a 2-year contract, will the unlimited data plan for month-to-month still be active after July 7?  maybe, they are saying yes, but for ho wlong its not certain
    2. When the Bionic finally comes out, will I be eligible for the subsidized cost? And can I keep the unlimited data for a 2-year contract?  yes
    Thanks!

  • Javascript Date() function not working

    Hi,
    I'm experiencing some problems with the Date() function in javascript. The problem is that the function doesn't seem to work. For example when I do "var date = new Date(); xfa.host.messageBox(date);" in the enter event of a date field, I get "Date is not a function" error message in de javascript debugger.
    Is there anyone out there who knows how why the Date function is not working in LiveCycle Designer. Am I using the Date function in an improper way or maybe I am using the wrong function?
    Please can anyone help me out?

    Hi Paul,
    Thanx for you reply. It worked fine.
    I also found out that following works as well:
    var MyDate = util.scand("dd-mm-yyyy",new Date());
    console.println("this date: "+util.printd("dd-mm-yyyy", MyDate));

  • IPhoto 11 Event Date Question

    I have a question about iPhoto 11 events.  My camera was set to the wrong date for part of an event.  I went in and did a batch change of the time and date of the affected photos.  However, the date range beneath the title of the event still has the old erroneous date, and the event gets sorted by this date range.  Is there a way to go in and change that date range under the title of the event?  I go to the event and click on info, and the event shows the correct date range for the pics, but it is not changing the date range under the title.  Thanks for any help in advance.

    Thank you - I had the same problem and found your helpful answer.  However, this is actually a work around to a bug in iPhoto - it's not how the Apple Support pages say it works and common sense says that if you change all the dates in an event it should sort to the right place without being re-created.  Can you help me with one more thing - how do I bring this to Apple's attention so that they fix it in a future release?
    Thanks again for the help.

  • Date question in Oracle

    hi
    how to insert (text) time: 09:44:02 and date:11/09/2007 to date filed in Oracle ?
    i have field Tdate (date) and Ttime (date) in oracle
    thanks in advance
    Edited by: GoldSoft on 16:33 22/08/2011

    Gold, I think SB has answered your question. You use to_date to pass the character representation of a date to Oracle and identify what format the date is in using a format mask. To get a date data type out of Oracle and present it any way you want you use the to_char function and a format mask to tell Oracle how to display the date information.
    You can find the date format mask characters listed in the SQL Language manual. Just look up to_date or to_char and there should be a reference to the available masks.
    HTH -- Mark D Powell --

  • Date Question

    I need to run a query to get certain information from my Oracle table that's over 9 months old. My query doesn't seem to be working properly. Below is my query:
    ---Getting today's date----
    currentDate = new SimpleDateFormat("MM/dd/yyyy").format(new java.util.Date());
    -----query to check for drawings that are over 9 months old-------
    queryRptchoice = "SELECT Drawing.dwgID, Personnel.prsnlID, Drawing.PMDwgNum, Drawing.dwgSize,";
    queryRptchoice += " Drawing.Title, Personnel.fname, Personnel.lname, Checked_Out.modNum,";
    queryRptchoice += " Checked_Out.chkoutDate, Checked_Out.Project, Checked_Out.AEFirm, Checked_Out.AEName";
    queryRptchoice += " FROM AJM.Drawing, AJM.Personnel, AJM.Checked_Out WHERE Drawing.dwgID = Checked_Out.dwgID";
    queryRptchoice += " AND Checked_Out.prsnlID = Personnel.prsnlID AND Drawing.isCheckedOut = 'yes'";
    queryRptchoice += " AND Checked_Out.isCheckedOut = 'yes'";
    queryRptchoice += " AND chkoutDate <= TO_DATE('" + currentDate + "', 'MM/DD/YYYY')";
    queryRptchoice += " AND chkoutDate < ADD_MONTHS(TO_DATE('" + currentDate + "', 'MM/DD/YYYY'), -9)";
    Any help would be greatly appreciated.

    This is a common question. Go into the JDBC forum and put the words date and oracle in the search forum box. Press search. You have a few options. You can format the date differently or use a preparedstatement.

Maybe you are looking for

  • DPS feature rich App

    Hi everyone One of my apps that I've created (on and off) for the last year has gone live in the App Store. It does cost £1.49 but it has pretty much every type of DPS/ HTML5 features that you can think of, including tilt animation. It's not perfect!

  • How to send HTML email in Mail?

    Hello All, I would like to write an email in HTML, just copy and paste the HTML code into mail, and have it sent as HTML. How do I have mail do this? Thanks!

  • My iTunes won't open on the new ios7

    my iTunes won't open with the new iOS7. it will start to open then crash.

  • Linkedin and Twitter web site do not open in Nokia...

    In My Nokia E5 following sites do not open: www.linkedin.com www.twitter.com I can open all other web sites without any difficulty. Please help. Regards Harry

  • ADF Popup not showing at fragment load

    Hi, I am calling a bean method in getter of command link at the load by binding it to a command link defined in bean, so when this fragment is called from other fragment then in this method i m doing some checks ,and based on particular condition i h