Skip to main content
February 24, 2015
Question

pass value from javascript into cfc

  • February 24, 2015
  • 1 reply
  • 348 views

Hi,

I want to pass the value from the input field into mycfcwithout click on the submit button.  ? can you please help?

Thanks

This topic has been closed for replies.

1 reply

WolfShade
Legend
February 27, 2015

Well, you could always use AJaX to pass it to the CFC.  But what will trigger it?  onBlur()?

onBlur="pass2cfc(this.value);"

function pass2cfc(vlu){

  var xhr = new XMLHttpRequest();

  xhr.open('POST','/path/to/cfc/filename.cfc',true);

  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

  xhr.send('cfcArg=' + vlu);

  xhr.onreadystatechange = function(){

    if(xhr.readyState == 4 && xhr.status == 200){

      //success code

      }

  }

}

HTH,


^_^