Skip to main content
Participant
April 17, 2011
Question

on page refresh loosing the cfform data

  • April 17, 2011
  • 1 reply
  • 451 views

Hi,

i begineer to the coldfusion and i am having hard time to get it solve.

i have a simple cfform like this.

  <cfform   name="DropDown" method="post"  preservedata="yes"  action="#attributes.pageurl#"  >

     <cfinput type="text" name="txtEmpFName" class="empInfo" required="yes" message="First Name is Empty." value="#variables.txtEmpFName#"/>

     <a href="#attributes.pageurl#?action=add&FamilyMember=2" >ADD Family Membe111</a>

     <input type="submit" class="form_button" name="Empdata" value="Continue">

</cfform>

in the above code, when i click on the submjit button then i can still see the value in the txtempfname. but when i click on the "a href" which calls same page, loosing value in the txtEmpFname (when i click on the link page refreshes and loosing the data.)

Can any one please help me out how to fix this issue.

Thanks a lot in advance!!!!!!

This topic has been closed for replies.

1 reply

Inspiring
April 17, 2011

The preservedata="yes" attribute and it's behavior, retaining submitted values, only apply to HTTP post requests, not HTTP get requests.  Bear in mind that a hyperlink is not a standard way of posting a form, so I would avoid using it that way.

If I understand your problem you need to present UI to add a family member on the page.  You might investigate JavaScript and AJAX as a method to do this without needing a form post or get request.

The CF docs can get you started, but implementing AJAX will require some trial and error on your part.

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7a01.html#WSAB82D475-38F4-48a7-B1D3-DDB4E6049DB2