function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anchal gargAnchal garg 

not able to Refresh html form value using <apex:actionfunction>

Hi ,

 

I am Working on a vf page that uses two forms viz html form and apex:form.

The logic for the page is that when user changes one particular value in html form then actionfunction would invoke that would change some value of html form.

The Problem is that i can't be able to refresh the html form value . However the actionfunction method invokes properly as well as the apex method associated with that also works .

 

Can any one help me out in this scenario.

 

The Snippet of my code is  : 

 

vf page :

---------

 

<apex:page controller="abc_controller" id="thepage">

<html>
<head>
</head>
<form id="fom1" name="form1" method="post" action="{!url}" enctype="multipart/form-data">

<select name="AccessType" id="AccesstypeId" OnChange = "ChangeValue1(this.value);">

<option value="Google">Google</option>
<option value="Yahoo">Yahoo</option>
</select>

<input type="text" value="{!value1}">

<br/>

 

</form>

<apex:form >

<apex:actionfunction name="ChangeValue1" action="{!updateurl}" reRender="thepage" oncomplete="alert('completed');" >
<apex:param name="val1" value="val1" assignTo="{!acl}"/>
</apex:actionfunction>

</apex:form>

</apex:page>

 

Controller

---

---

public void updateurl

{

url=acl;

 

}

 

 

any help in this scenario will be much apreciated.

Anchal gargAnchal garg

I just forgot to tell in this code : 

 

whatever value i am putting in constructor will remain in html form.

however upon changing picklist value to some other value will call controller method and update url (variable)  value.

But on html fom old value is dispayed instead of refreshing the fom value..

 

so the complete code for controller is 

 

public class abc

{

public string acl {get;set;}

Public string url {get;set;}

 

public abc()

{

url='www.google.com';

acl='www.google.com';

}

public void updateurl()

{

system.debug('$$'+acl);      // here changed value comes

url=acl;

}

 

}

 

Thanks in  advance .

Anchal gargAnchal garg

hi , 

 

i have found the solution for that.

basically it was due to action function rerendering issue.

finally the code is working as required.