Need to call a Javascript function

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
legend986
Forum Contributor
Posts: 258
Joined: Sun Jul 15, 2007 2:45 pm

Need to call a Javascript function

Post 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?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post 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.
User avatar
legend986
Forum Contributor
Posts: 258
Joined: Sun Jul 15, 2007 2:45 pm

Post 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? :(
Post Reply