views:

69

answers:

2

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>
A: 

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.

Erik
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>How do I format replies? Doesn't see to work well. I put it in the top as well to make it easier to read.
Joe
You're using a jquery selector but there is no .value function in jQuery - its .val()
Erik
Also, define "doesn't work" -- what happened when you manually set a value. Where's the line of code that's doing something with categoryDetailId? You might be better off linking the page rather then dropping it in a pastebin.
Erik
Okay I changed that and I still have the same issue. By doesnt work, I get Nan for them. The pages are all local and in Zend Studio so it isn't easy to display.
Joe
A: 

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.

prodigitalson
I am using Dojo's tabbed forms and Jquery's add fields. Dojo's tabbed forms are much nicer and jquery's add fields are much nicer.
Joe
Thats not really a good practice to get in to. Anyhow move your `echo $this->dojo()` call to inside the head of the document. I suspect this will work out alot of your issues.
prodigitalson
Thanks, that helped.
Joe