Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add lines without a refresh 1

Status
Not open for further replies.

HCAJA

Instructor
May 8, 2009
1
CA
I am looking to know if the following is possible in Coldfusion.

I need to enter lots of payers. We enter the name and address.

Is there a way to add a new line without having to refresh the page?

Do I always have to click on add and wait that the page refresh and then enter my info and click add againt and wait. Is there a way to just keep adding and then click add?

I hope someone answers I posted this question on multiple forums and no one even answers?
 
Yes, but you're going to probably want to use something like jQuery to help out. Basically, each time you enter one payer, you'd use jQuery's $.get() function to append another name and address input to the HTML.
 
jQuery and ajax is what you're looking for.

You will need to do a post to your .cfm and then within that .cfm, you will need to output the new row:

Code:
$.ajax({
									type:"POST",
									url:"act_mySubmit.cfm",
									data:formData,
																		success: function(data) {
											$("#result").responseText;
											$("#sendButton").html(data);
									},
									error: function(xhr,ajaxOptions,thrownError) {
										alert(xhr.status);
										alert(thrownError);
									}
								});
						return false;	
				} ,

$("#result").responseText; >> this tells jQuery to write whatever is returned from act_mySubmit.cfm to an empty div with an id of "result".
<div id="result"></div>

 
FALCONSEYE, I hadn't heard of jQuery or didn't think it related to my work with CF. Thanks for posting the link, example, and explanation. This is another post for my toolbox. Have a star on me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top