Highlighted

pass value from javascript into cfc

New Here ,
Feb 24, 2015

Copy link to clipboard

Copied

Hi,

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

Thanks

TOPICS
Getting started

Views

271

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

pass value from javascript into cfc

New Here ,
Feb 24, 2015

Copy link to clipboard

Copied

Hi,

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

Thanks

TOPICS
Getting started

Views

272

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 24, 2015 0
LEGEND ,
Feb 27, 2015

Copy link to clipboard

Copied

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,


^_^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 27, 2015 0