Javascript doesn't pull value
I have this piece of code: 开发者_高级运维
var categoryDetailId = $("#createEventForm-categoryDetail-idCategory").val();
and this html from myrendered page:
http://erxz.com/pb/22844
When I hit the button it goes to Nan
Update: I went in and set that and it didn't work still. I also have this one.
var eventInformationId = $("#createEventForm-eventInformation-idEventInformation").value();
it doesn't set eventInformationId either. The line in the html for it is:
<input type="hidden" name="createEventForm[eventInformation][idEventInformation]" value="1" id="createEventForm-eventInformation-idEventInformation" /></dd>
Why are you using both Dojo and jQuery? You should use one or the other. Additionally, your ouput of your Zend_Dojo related stuff is outside the HTML which invalidates the document - id guess jQuery is having trouble with this as it expects the dom to be valid. IT may not be the case that this is the problem but until you rule it out its kind of pointless to investigate other things.
Now the error youre getting is NaN
which mean "Not a Number". Usually this is an issue when you try to perform a nuber type operation on an invalid value type like NULL
or an Object or what have you.
Well, I went to the page in your link to see what value should be going into categoryDetailID and found
<input type="hidden" name="createEventForm[categoryDetail][idCategory]"
value="" id="createEventForm-categoryDetail-idCategory" />
Since the input has no value, javascript is pulling the value - none.
精彩评论