Vaishak Suresh
Vaishak Suresh

Reputation: 5855

Coldfusion cftextarea and datefield not working with jquery .load()

I am trying to load a coldfusion page from a page that is not a coldfusion app using jquery's load function as below.

  $("#eventboxol").load('/cfapps/homepage_updates/deleteevent.cfm?eventid='+id);

The page loads alright and works too, but the datefield and rich text area do not work. Nothing happens when i click the datefield and the rich text area appears as a normal text area. I am guessing this could be because the calling page is not a coldfusion page. Is there some way to force the load to process the CFM page?

Edit: These are the fields that are not being rendered properly:

<cftextarea html="no" width="220" height="60" richtext="yes" toolbar="BasicLink" toolbarOnFocus="true" name="description" required="true"></cftextarea>
<cfinput type="datefield" name="enddate" maxlength="30">

They work as expected when I directly access the page instead of through the load function.

Upvotes: 1

Views: 450

Answers (2)

steve
steve

Reputation: 1490

Try adding an ID="controlName" to both of your coldfusion properties. Your only giving it a name and not an ID.

--- sorry, can't figure out how to delete my answer. Misread your question thought you couldnt access your fields.

Upvotes: 0

Brian FitzGerald
Brian FitzGerald

Reputation: 3109

This sounds to me like perhaps you are trying to initialize your javascript controls (i.e. perhaps the $("#datepicker").datepicker()) method before the necessary markup (from the cfml page) is actually available within the dom.

In other words, make sure you load the cfml page in first, and only after the load is complete do you run your javascript to initialize your datepicker and rich text editor (i.e. this should happen on the successful callback of the load method)

psuedo code

$('#content').load('ajax/cfml_page.cfm', function() {
  // setup js controls
});

Hope that helps

EDIT: Oops, now that I see you are attempting to use the built in cfml form controls, my answer is not as relevant. For the sake of leaner javascript and more flexibility, it might be worth considering abandoning the built in cfml form controls and using jqueryui or another library to accomplish this task.

Upvotes: 2

Related Questions