Hi,
I want to delete the Value in the property that is type String Array. Deleting the value is working fine but I am having in issues in deleting the value.
Suppose I want to delete the value here:
Before deleting:
After deleting the value: 24.56.43.45 I am getting the comma at the end of the values and box getting not deleted along with the value. Please find the screenshots below.
After deleting:
Could anyone let me know, how to delete the entire value with box.
This is my code I used for deletion of value from form.
for(Value val:ipList){
log.info(val.getString() + " , ");
if(val !=null && val.getString().equals(deleteValue)){
ipList.remove(val);
break;
}
}
Please help me!!
Thanks,
Ratna Kumar.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi All,
Many thanks for your suggestions!! I have resolved the issue.
I have used the ValueFactory for adding or deleting the value from the property that is String Array. Below is the code I have used.
if (ipValues != null && isDeleteIPExist && deleteip != null && !deleteip.trim().equals("")) {
log.info("Deleting IP Address : " + deleteip);
ValueFactory vFctory = node1.getSession().getValueFactory();
Value delp = vFctory.createValue(deleteip);
boolean isDel = ipList.remove(delp);
log.info("IP Deleted: " + deleteip + " ,is Deleted: " + isDel);
isModified = true;
}
Thanks,
Ratna.
Views
Replies
Total Likes
Ratna Kumar wrote...
Hi,
I want to delete the Value in the property that is type String Array. Deleting the value is working fine but I am having in issues in deleting the value.
Suppose I want to delete the value here:
Before deleting:
After deleting the value: 24.56.43.45 I am getting the comma at the end of the values and box getting not deleted along with the value. Please find the screenshots below.
After deleting:
Could anyone let me know, how to delete the entire value with box.
This is my code I used for deletion of value from form.
for(Value val:ipList){
log.info(val.getString() + " , ");
if(val !=null && val.getString().equals(deleteValue)){
ipList.remove(val);
break;
}
}
Please help me!!
Thanks,
Ratna Kumar.
I guess you need to check for empty as well..
Views
Replies
Total Likes
Agreed - looks like you are letting an empty string exist.
Views
Replies
Total Likes
Hi Ratna,
Either it is not coming inside your custom if condition Or the reference list is wrong. Also just check for empty & not val.getString().equals(deleteValue)
Thanks,
Views
Replies
Total Likes
Did any of the suggestion worked for you?
~kautuk
Views
Replies
Total Likes
Hi All,
Many thanks for your suggestions!! I have resolved the issue.
I have used the ValueFactory for adding or deleting the value from the property that is String Array. Below is the code I have used.
if (ipValues != null && isDeleteIPExist && deleteip != null && !deleteip.trim().equals("")) {
log.info("Deleting IP Address : " + deleteip);
ValueFactory vFctory = node1.getSession().getValueFactory();
Value delp = vFctory.createValue(deleteip);
boolean isDel = ipList.remove(delp);
log.info("IP Deleted: " + deleteip + " ,is Deleted: " + isDel);
isModified = true;
}
Thanks,
Ratna.
Views
Replies
Total Likes
Views
Likes
Replies