Hello Friends I am trying to check or print the component values after the saving event is triggered.
I want to check on each component save. User added the www.blahblh.com URL or not then take action as per URL I am getting.
public void ComponentSaveAction(Component subject, SaveEventArgs args, EventPhases phase)
{
Component comp = subject;
string str = comp.Content.Value; // in str values getting empty
}
updated code.
public void ComponentSaveAction(Component subject, SaveEventArgs args, EventPhases phase)
{
ItemFields fields = new ItemFields(component.Content, component.Schema);
foreach (var items in fields)
{
if(items.ToString().Contains("www.blahblah.com"))
{
//throw pop up exception
}
else{
//save logic
}
}
}
Using this code iI am able to check whether the component field containcontains the urlURL or not. Bur problem is its workworks only for textfieldthe text fields. How to read the data if the component field containcontains EmbeddedSchemaField,ComponentLinkField ComponentLinkField. Any
Any solution to catch this all filed in parent node level and read as string ?
Thanks in advance :)