Skip to content

Primary No Ref selection

Vahid H edited this page Mar 2, 2014 · 1 revision

Primary No Ref selection

In this example we have : Departments that have Many Offices and Offices that have a no reference binding to Departments.

Departments being the primary table that this no reference binding stems from, so here is the code and working example:

(poor example I know)

	Department
        <g:selectPrimaryNR 
        id="myDepartment" 
        name="department"
		domain='ajaxdependancyselectexample.Departments' 
		searchField='name' 
		collectField='id'
		bindid="offices"

		domain2='ajaxdependancyselectexample.Offices' 
		searchField2='name' 
		collectField2='id'

		noSelection="['null': 'Please choose Department']" 
		setId="MyOffices" 
		/> 
		
		Office:
		<g:select 
		name="office" 
		id="MyOffices" 
		optionKey="id" 
		optionValue="name" 
		from="[]" 
		noSelection="['': 'Please choose Department']" /> 
		<br> 
		<input type=submit value=go> 
		</form>

Clone this wiki locally