...

View Full Version : Problems with my form, php, html, javascript ...



dimitryous
08-31-2006, 04:34 PM
Hi! Again...

Here is my php 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:

...
<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)

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.

devinemke
08-31-2006, 04:45 PM
you are forgetting the closing double quote (") in the href tag

dimitryous
08-31-2006, 04:59 PM
you are forgetting the closing double quote (") in the href tag
You mean:


...
$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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum