Page 1 of 1

Need to call a Javascript function

Posted: Fri Aug 24, 2007 2:04 pm
by legend986
I'm trying to make a form in such a way that when the user click on a button, a form should be displayed. In the form, there is a text area. I converted that textarea into a WYSIWYG textarea using a javascript file wysiwyg.js which is included in the header file. The js file expects something like the following to convert the default text area:

Code: Select all

<textarea name="abstractbox" id="abstractbox"></textarea><script language="JavaScript">generate_wysiwyg('abstractbox');</script>
The radio button that I talked about in the beginning is linked to an Ajax call function that when it is selected, makes a call to a php script that sends the form's html to the current page to be displayed.

For example,

register.php --> Current file displayed to user in which the radio button is there. Depending on the radio button that was selected, an ajax call is made to content.php
content.php --> Contains a if loop that determines which radio button was pressed and sends a html output of a form to register.php for display

The problem is that the javascript is not being sent by the content.php file i.e. the generate_wysiwyg('abstraction'); and as a result, the text area is not being converted. Can someone help me get out of this problem please?

Posted: Fri Aug 24, 2007 10:43 pm
by Kieran Huggins
This sounds WAY more complicated than it should be.

I encourage you to look into jQuery for the javascript side, and do all your page modifications in javascript. If you're using templates with partials, you could use an ajax call to get the partial template of the form, but I have a feeling it would be even simpler.

Posted: Sat Aug 25, 2007 5:39 am
by legend986
Oh my... I've been using prototype and scriptaculous and it did take me quite some time to get a hang of it... And now, jQuery... Well, isn't there any other way? :(