Ajax Problem

I’m trying to generate a random number which acts as the ID for Request table in the Release Planning Project,

I’m able to generate the random number successfully but I’m unable to set this random number as the ID value for the table using ajax on RoR .

Please help me to set the ID as a system generated number ,

Thanks

Manoj Pandey wrote:

I'm trying to generate a random number which acts as the ID for Request table in the Release Planning Project,

I'm able to generate the random number successfully but I'm unable to set this random number as the ID value for the table using ajax on RoR .

Post some code.

You don't seem to have an AJAX problem. If the ID appears in a model or controller, then you write the ID into the file using common RHTML stuff like <%= id %>

If the ID then comes back, it should go as a <input type='hidden' ... /> field. AJAX might route its parent <form> back; is that what you need?

I’m Trying to store the requesttpeid which is coming form the requesttypes table and I’m trying to stroe that ID in Requests table as requesttypetid.

Here’s what I’m trying,

in the controller :

def new @ end

def edit @requesttypes = Requesttype.find_all @emprequest = Emprequest.new @emprequest.requesttypeid = params[:reqtype] @emprequest.save end

In the view (_form.rhtml)

The problem is that i’m unable to store this id in the table and it is displaying an error like nil.object

But this is working fine when I tried this with out using ajax.

Can you please help me to over come this problem,