I am wondering if it is possible to set embedded ruby variables in javascript. I've tried but to no avail. I'm thinking the javascript block won't recognize the <% %> erb tags.
What I want to do is basically call a javascript function from an onclick="setFie ld('first_name' )"
function setField(name)
{
<% fieldName = name %>
}
I don't think it's possible, because...
User Profile
Collapse
-
Embbeded Ruby (erb) from Javascript
-
Finding next ID auto increment
I'm having trouble trying to find the next ID in a mysql table which is set to autoincrement. I would like to retrieve this before the record is created so I can store its ID as a foriegn key with into another table.
I've tried a query
SELECT Max(ID) nextID FROM screenings
But I found this works until I delete the most recently created records because the Max ID is no longer the one previous of the next... -
Javascript form object name from string
I'm having trouble trying to access textfield through javascript by using a string of it name to reference the object. For example
When clicking on a link which calls this function, it will toggle a paragraph's readOnly ability. However I'm hardcoding in paragraph_1 as the name of the textfield. I want...Code:function toggle(num){ document.form.paragraph_1.readOnly=!document.form.paragraph_1.readOnly; }Last edited by Niheel; Apr 23 '06, 04:44 PM.
No activity results to display
Show More