Hexagon Geospatial
MENU

GeoMedia Smart Client

GeoMedia Smart Client community discussion board is where you can create, contribute and share information and knowledge in regards to configuring as well as working with GeoMedia Smart Client. Find your answers, share your knowledge and help build a strong GeoMedia Smart Client community.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 81
Registered: ‎09-18-2018
Accepted Solution

GMSC Workflow : Conditional Required attribute for a Form field

[ Edited ]

Hi,

 

I am looking to check change turn required if another field has values:

 

Similar to visible I thought that something could be done

 

Capture.PNG

 

This same approach works for visible: 

 

Captur2.PNG

but not for require:

Capture3.PNG

 

required attribute only seem to allow true/false or SESSION[...]. 

 

I wonder if there is any way I can make a field required if depending on a third field? (e.g. in my case FORM.isOnGoing)

 

Thank you.

Highlighted
Staff
Posts: 1,033
Registered: ‎10-18-2015

Re: GMSC Workflow : Conditional Required attribute for a Form field

hi,

 

how about a custom validator?

 

http://smartclient.intergraph.at/documentation/JavascriptValidation#Writing_your_own_validators

 

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Staff
Posts: 37
Registered: ‎02-27-2018

Re: GMSC Workflow : Conditional Required attribute for a Form field

[ Edited ]

Hi,

I used to do this with a javascript function that listen to change in the third field and then set the field to required/not required. It works with GMSC 2016. You might want to try if it still works with GMSC2018.

 

IG.getFieldById('your_third_field').value.subscribe(function(newValue){
	
	if(newValue==1 || newValue==2 )
	{
		        
				IG.getFieldById('your_field').required(true);
				
	}
Frequent Contributor
Posts: 81
Registered: ‎09-18-2018

Re: GMSC Workflow : Conditional Required attribute for a Form field

[ Edited ]

Hi,

 

Thank you for your reply.

 

Are you meaning to add a new resource (SCRIPT) and perform this when the form is loaded as a Custom Script?

 

I was looking for something in runtime. So if you click on a form field and then on the side bar you will see the 'pencil' icon on 'Required' attribute that allow you to build a javascript but :

 

Capture.PNG

(please open this image in a new window to see the content)

 

Thanks.

 

Staff
Posts: 37
Registered: ‎02-27-2018

Re: GMSC Workflow : Conditional Required attribute for a Form field

Hi,

I used it as a resource, indeed. and not in the required-configuration field.

 

The script will be loaded with the form (use the form:ready event for this) but because of the  "subscribe" it will listen to changes in your third field.

 

 

IG.vent.on('form:ready', function(form){
    IG.getFieldById('your_third_field').value.subscribe(function(newValue){
        if(newValue==1){ 
            IG.getFieldById('your_field').required(true);
        } 
    });
})

  But as I said, I am starting in a week to test all my workflows with GMSC 2018, so something might have changed in the API, that I haven't realized yet.

 

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.