Jump to content
Sign in to follow this  
henning1518

Default value for group field with condition

Recommended Posts

Hi,

 

is it possible to set a default value for the field "Group" (dtlookup) ?

My Code:

 

<PDM_SET args.CST_defaultgroup=0>
<PDM_LIST PREFIX=list WHERE="member=U'$cst.id'" FACTORY="grpmem" SORT="group">
	<PDM_IF "$list.group" == "5F3093F261DB11479D828B6338780664">
		<PDM_SET args.CST_defaultgroup=1>
	</PDM_IF>
</PDM_LIST>

<PDM_IF "$args.CST_defaultgroup" == 1>
<PDM_MACRO name=dtlLookup hdr="Group" attr=group evt="onBlur=\\\"detailSyncEditForms(this)\\\"" make_required=yes >
<PDM_ELSE>
.....

thanks.

Edited by henning1518

Share this post


Link to post
Share on other sites

I found a solution that works for me:

function zgroupauto() {
	document.main_form.elements["SET.group"].value = "5F3093F261DB11479D828B6338780664"; 
    document.main_form.elements["group_combo_name"].value = "Testgroup"; 
}

 

<PDM_SET args.CST_defaultgroup=0>
<PDM_LIST PREFIX=list WHERE="member=U'$cst.id'" FACTORY="grpmem" SORT="group">
	<PDM_IF "$list.group" == "5F3093F261DB11479D828B6338780664">
		<PDM_SET args.CST_defaultgroup=1>
	</PDM_IF>
</PDM_LIST>
<PDM_IF "$args.CST_defaultgroup" == 1> 
<body class="detailro" onload="loadActions();zgroupauto();" onunload="unloadActions()">
<PDM_ELSE>
<body class="detailro" onload="loadActions();" onunload="unloadActions()">
</PDM_IF>

Can i make it better ? :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×