hello everyone !
i hope you can give me ideas.
am using phprunner 10.2
in summary , i want my dropdown list which is dependent on a dropdown list wich has a default value set, to get populated on page load.
more details....
i have two dropdown boxes 'A' and 'B'
let's call
'A' = fk_route_id [size="2"]and[/size]
'B' = Seat_id
dropdown list 'B' is filtered by value selected on 'A'
when i load the add page , i select a value on on list 'A' and values on list 'B' are filtered successfully.
i wan't to take this further so that on Add page load, a default value on dropdown list 'A' is set , which then filters dropdownlist 'B'.
i have successfully set the default value on dropdown list 'A' using
Before Display
$pageObject->setProxyValue("TripInfo",$pageObject->getMasterRecord());
Javascript onload event
var ctrlRouteId = Runner.getControl(pageid,'fk_route_id');</div><div> ctrlRouteId.setValue(proxy.TripInfo['fk_trip_route']);
the issue am having is that dropdown list 'B' is stays empty when the value on dropdown 'A' is set automatically during page load,
i have to change the values on 'A' manually by clicking on the value so that 'B' is populated.
does anyone , have an idea of how i can make dropdownlist 'B' get the list data ?
Question? : if Default A has many records but you default to one . What is set in the Default value box in the lookup wizard in "A" ?? Is it empty?
If you pass values from PHP to Javascript , I am not sure if dependant dropdown will pick up "B" . Unless you do the same for "B".
I believe this is the way the lookup wizard works, although I may be incorrect here. Maybe Admin will chime in on this.
I have always used a different approach with two fields dependency when coming from another master or another table.
$_GET["fk_route_id"] for say A default value , which will still show one or more choices if lookup wizard is setup correctly for B.
The Master Table or another table I have used view as custom field with the option : $value ="<a href='Select blablabla</a>";
"Quote from manual : Default value will be assigned to field directly on the "Add new" page. Default value should be a valid PHP expression (text expressions must be quoted). "
With your code B doesn't know what A is yet I believe to fill in auto when page loads because it is not directly using lookup wizard code from source. Like I stated check with admin or put in a ticket if this doesn't help.