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 I am able to check whether the component field contains the URL or not. Bur problem is its works only for the text fields. How to read the data if the component field contains EmbeddedSchemaField, ComponentLinkField.
Any solution to catch this all filed in parent node level and read as string?