In RJS, how can I reset particular field (password) of form, but not
login?
And also how can I bring cursor to input field when page is loaded? I
currently have to click in the login field before typing.
Thanks.
In RJS, how can I reset particular field (password) of form, but not
login?
And also how can I bring cursor to input field when page is loaded? I
currently have to click in the login field before typing.
Thanks.
On Jan 2, 2008, at 3:11 AM, Vapor … wrote:
In RJS, how can I reset particular field (password) of form, but not
login?
If this is an AJAX call, you can use render :update such as
render :update do |page|
page << “$(‘password_field_id’).value = ‘’;”
page << “$(‘password_field_id’).focus();”
end
If going that route, I’d probably write a javascript function to do
it and then just call the function
render :update do |page|
page << “reset_password();”
end
or even
page.call ‘reset_password’
And also how can I bring cursor to input field when page is loaded? I
currently have to click in the login field before typing.
Depending on how you’ve structured your layouts and views, you can
assign something to the onload event handler of the body tag
Probably, though, you are using layouts and don’t have very easy
access to the body tag, so you can something like this at the bottom
of your view
or even render a partial to do it if you might need it on multiple
pages. You could pass the DOM id in as a local to make it DRY.
I’m sure there are other ways to accomplish your goals, but these can
at least be jumping off points.
Peace,
Phillip
WOW
now this is what I call help
thanks a lot
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs