How to assign a id dinamically to checkbox created dinamical

hi

Vasu Re wrote:

hi

it got sumbmitted before writing Q:),
ok so iam using
<%= check_box_tag ( “id”,“word”,false, :onclick => remote_function( ))%>
for sending remotecall but i want “id” and value ie “word” to be diff
as i load

like iam looping through records as shown below

<%for x in @xrecords%>
<%= check_box_tag ( “<%x.id%>”,“word”,false, :onclick =>
remote_function( ))%>
<%end%>
but this is not taking <%x.id%> but throwing exception,please let me
know if there is a way to do this ie assigning the id dinamically as i
loop

<%for x in @xrecords%>
<%= check_box_tag ( “<%x.id%>”,“word”,false, :onclick =>
remote_function( ))%>
<%end%>
but this is not taking <%x.id%> but throwing exception,please let me
know if there is a way to do this ie assigning the id dinamically as i
loop

Hi Vasu,

You need to be putting x.id within curly brackets so that it reads:

<%= check_box_tag ( “#{x.id}”,“word”,false, :onclick =>

remote_function( ))%>

That should stop the exception.

Kind Regards

Robin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs