You need to sign in to do that
Don't have an account?
Amit_Trivedi
In the above image i would like to add 3rd, 4th and so on upto 10 option on click of add option and implement reove link to remove perticular option(textarea) and if question type is descriptive i would like to hide all options
How to add and remove inputTextArea on button click in repeat tag ?
In the above image i would like to add 3rd, 4th and so on upto 10 option on click of add option and implement reove link to remove perticular option(textarea) and if question type is descriptive i would like to hide all options
here is code..
public class TEST{
public list<String> lstOptions{get;set;}
public List<Integer> iter {get;set;}
public string que{get;set;}
integer i;
public TEST(){
lstOptions = new list<String>();
iter = new List<Integer>();
i=0;
}
public void addRow(){
lstOptions.add('');
iter.add(i);
i++;
}
//Call this methos on change of select list
public void hideOptions(){
lstOptions.clear();
}
}
=======
<apex:page controller="TEST">
<apex:form id="frm">
<apex:inputText value="{!que}"/>
<table>
<apex:repeat value="{!iter}" var="it">
<tr><td>
<apex:inputText value="{!lstOptions[it]}"/>
</td></tr>
</apex:repeat>
</table>
<apex:commandButton value="Add" action="{!addRow}" reRender="frm"/>
</apex:form>
</apex:page>
:::======================================================================:::
Qusetion Solved ? then mark as best answer to make helpful to others .....
All Answers
public class option{
public string id{get;set;}
public <Type Of Object Binded On Page> name of Object{get;set;}
}
call that function passing that id...
You can try using jquery/ javascript refer links below:
http://www.mkyong.com/jquery/how-to-add-remove-textbox-dynamically-with-jquery/
http://www.smarttutorials.net/dynamically-add-and-remove-textbox-using-jquery/
here is code..
public class TEST{
public list<String> lstOptions{get;set;}
public List<Integer> iter {get;set;}
public string que{get;set;}
integer i;
public TEST(){
lstOptions = new list<String>();
iter = new List<Integer>();
i=0;
}
public void addRow(){
lstOptions.add('');
iter.add(i);
i++;
}
//Call this methos on change of select list
public void hideOptions(){
lstOptions.clear();
}
}
=======
<apex:page controller="TEST">
<apex:form id="frm">
<apex:inputText value="{!que}"/>
<table>
<apex:repeat value="{!iter}" var="it">
<tr><td>
<apex:inputText value="{!lstOptions[it]}"/>
</td></tr>
</apex:repeat>
</table>
<apex:commandButton value="Add" action="{!addRow}" reRender="frm"/>
</apex:form>
</apex:page>
:::======================================================================:::
Qusetion Solved ? then mark as best answer to make helpful to others .....