# Adding javascript inside create view

**URL:** <https://www.ruby-forum.com/t/adding-javascript-inside-create-view/135046>\
**Category:** Rails\
**Created:** [April 17, 2008, 1:09pm UTC](https://www.ruby-forum.com/t/adding-javascript-inside-create-view/135046 "2008-04-17T13:09:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![irsami1982](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@irsami1982](https://www.ruby-forum.com/u/irsami1982)\
**Post date:** [April 17, 2008, 1:09pm UTC](https://www.ruby-forum.com/t/adding-javascript-inside-create-view/135046/1 "2008-04-17T13:09:51Z")

</div>

I am a newcommer in both AS and RoR. I have a user active scaffold.  
The user has name and password. I want to add a password strength  
javascript inside the create view of user.

How can I customize my user default active scaffold view to add the  
password strength javascript?

I looked at the Rjs files of Active Scaffolding. They are generic and  
complicated. Can I customize rjs for this particular object user?

How can I render both AS default Rjs as well as mine?

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![irsami1982](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@irsami1982](https://www.ruby-forum.com/u/irsami1982)\
**Post date:** [April 17, 2008, 1:50pm UTC](https://www.ruby-forum.com/t/adding-javascript-inside-create-view/135046/2 "2008-04-17T13:50:28Z")

</div>

> How can I customize my user default active scaffold view to add the  
> password strength javascript?

you can put your own JS in \<%= javascript\_include\_tag ‘your\_JS\_Name’ %\>

and call your JS in your form \<% form\_tag %\> or to the password\_field.

Reinhart  
[http://teapoci.blogspot.com](http://teapoci.blogspot.com)

---

<div class="post-metadata">

**Author:** ![irsami1982](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@irsami1982](https://www.ruby-forum.com/u/irsami1982)\
**Post date:** [April 17, 2008, 2:07pm UTC](https://www.ruby-forum.com/t/adding-javascript-inside-create-view/135046/3 "2008-04-17T14:07:40Z")

</div>

Thanks a lot.

Actually I am using Active Scaffold. I want to call the javascript  
function from inside a view which also renders Active Scaffold default  
view.

Can u help be about this?

Thanks a lot in advance.

---

<div class="post-metadata">

**Author:** ![irsami1982](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85f322/32.png) [@irsami1982](https://www.ruby-forum.com/u/irsami1982)\
**Post date:** [April 17, 2008, 6:41pm UTC](https://www.ruby-forum.com/t/adding-javascript-inside-create-view/135046/4 "2008-04-17T18:41:31Z")

</div>

I think (it’s been a while), that you can customise the output of each  
form element for your view from within the helper that accompanies the  
model you’re working with (e.g. UserHelper)

Try this to get you started:  
[http://activescaffold.com/docs/form-overrides](http://activescaffold.com/docs/form-overrides)

I figure you don’t just have to return the field, but could return  
some html and a field observer that your password strength js could  
use.

On Apr 17, 1:07 pm, Ishrat rahman Sami \<rails-mailing-l…@andreas-
