Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2006
    Location
    france
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Problems with my form, php, html, javascript ...

    Hi! Again...

    Here is my php code:
    Code:
    ...
    $dayLink="<a href=\""
    .$this->url
    .$this->yearID."=".$year."&amp;"
    .$this->monthID."=".$month."&amp;"
    .$this->dayID."=".$day
    ." onClick=\"return transfertDateToForm('datepickerform', 'date', " . $yyyymmdd. ")"
    ."\">".$day."</a>";
    ...
    Looking at the source I get the resulting html code:
    Code:
    ...
    <a href="/_DUK/FormTest.php?amp;yearID=2006&amp;monthID=8&amp;dayID=31 
    onClick="return transfertDateToForm('form1', 'field1', 2006/08/31)">31</a>
    ...
    
    <form action="" method="get" name="form1">
    <input name="field1" type="text" value="" size="12" maxlength="12" />
    <input name="send" type="button" value="Send" />
    </form>
    ...
    My Javascript function is: (located at the top)
    Code:
    function transfertDateToForm(theForm, theFieldName, theValue)
    {
    	var theField = theForm.elements[theFieldName];
    	alert(theField); // this does not work ...
    	theField.value = theValue;
    	theField.focus();
        return true;
    }
    The URL of my page is:
    blablabla/FormTest.php?yearID=2006&monthID=8&dayID=31%20onClick=

    When I click on "31", I get the correct result but
    the date (2006/08/31 in this case) is not transferred to the field of my form...


    Bad parsing from my browser? What about this "%20onClick=" at the end of URL?
    Mistakes everywhere?
    Mystery...

    Thanks for help to all.
    dimitryous r.
    Last edited by dimitryous; 08-31-2006 at 05:37 PM.

  • #2
    Regular Coder devinemke's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    443
    Thanks
    0
    Thanked 12 Times in 11 Posts
    you are forgetting the closing double quote (") in the href tag

  • #3
    New Coder
    Join Date
    Aug 2006
    Location
    france
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry

    Quote Originally Posted by devinemke
    you are forgetting the closing double quote (") in the href tag
    You mean:

    Code:
    ...
    $dayLink="<a href=\""
    .$this->url
    .$this->yearID."=".$year."&amp;"
    .$this->monthID."=".$month."&amp;"
    .$this->dayID."=".$day
    ."\" onClick=\"return transfertDateToForm('datepickerform', 'date', " . $yyyymmdd. ")"
    ."\">".$day."</a>";
    I miss the double quote. Thank you.

    But still, the "onClick" stuff does not want to do the job.

    Thanks.
    Last edited by dimitryous; 08-31-2006 at 06:02 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •