Hi there,
I have created two interface which are MedicalRequestForm and EquipmentRequestForm, then I created third interface as RequestForm where I took a radio button and shown the value as RequesType (Medical and Equipment).
I want that MedicalRequestForm or EquipmentRequestForm must be shown on the basis of radio button selection which is working. But In my first both interfaces, I have one dropdown, so whenever I am selecting a value from the dropdown, then whole Interface (RequestForm) is getting reload/refresh.
Note: I took the rule input as ZMS_Requests in all the interfaces separately.
Please see the below screenshots:
1. MedicalRequestForm:
2. EquipmentRequestForm:
3. RequestForm (without selection):
4. RequestForm (with selection of Medical):
5. RequestForm is getting back as screenshot no.3 when I select a value from dropdown Animal Name as above screenshot.
Could anyone of you help me to resolve this issue?
Please let me know if you need code.
Thank you in advance!
Regards,
Shubham Kumar
Discussion posts and replies are publicly visible
Hi, can you check what are you saving in drop-down field? Are you making radio button selection null here? If you are saying ,after selecting from drop down you are going back to screenshot 3 then it means that selected radio button value is getting null.
Hi, thanks for your response.
I am saving the value for radio button, and for dropdown also.
I resolved it. I was passing the null value at line no. 33
Before:
contents: rule!ZMS_MedicalRequestForm(ZMS_Requests: "")
Now:
contents: rule!ZMS_MedicalRequestForm(ZMS_Requests: ri!ZMS_Requests),
good job.
Thank you
good job
Hi Gopalk,
I want to refresh the values whenever I am changing the radio button.
Example:
If I selected "Medical" and selected a value from dropdown Animal Name, now I am switching to "Equipment", so whatever I entered the value from "Medical", that must be refreshed or set to null...
Could you please help me to achieve this.
Hi Shubham, you can make the rule inputs null in saveInto parameter based on raidio button selection. SOme thing like below,
saveInto:{
if(
ri!ZMS_Requests.requesttype="Equipment",
{
a!save(ri!input1,null),
a!save(ri!input2, null)
}
you can make any field null based on your requirements.
Thanks for your response!
I am getting confused. Pasted my code below, could you please help where I do?
a!localVariables( local!reqTypes: cons!ZMS_REQUEST_TYPES, a!formLayout( label: "Raise A Request", contents: { a!columnsLayout( columns: { a!columnLayout(contents: {}), a!columnLayout( contents: { a!radioButtonField( label: "Request Type", labelPosition: "ABOVE", choiceLabels: local!reqTypes, choiceValues: local!reqTypes, value: ri!ZMS_Requests.requesttype, saveInto: ri!ZMS_Requests.requesttype, required: true, requiredMessage: "please select request type", choiceLayout: "COMPACT", choiceStyle: "STANDARD", validations: {} ) } ), a!columnLayout(contents: {}) } ), a!boxLayout( label: "Medical Request", contents: rule!ZMS_MedicalRequestForm(ZMS_Requests: ri!ZMS_Requests), showWhen: if( ri!ZMS_Requests.requesttype = local!reqTypes[1], true, false ), style: "SUCCESS", shape: "ROUNDED", marginBelow: "STANDARD" ), a!boxLayout( label: "Equipment Request", contents: rule!ZMS_EquipmentRequestForm(ZMS_Requests: ri!ZMS_Requests), showWhen: if( ri!ZMS_Requests.requesttype = local!reqTypes[2], true, false ), style: "SUCCESS", shape: "ROUNDED", marginBelow: "STANDARD" ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", submit: true, saveInto: { a!save( ri!ZMS_Requests.createdby, loggedInUser() ), a!save( ri!ZMS_Requests.requestorname, loggedInUser() ), a!save(ri!ZMS_Requests.createddate, now()), a!save(ri!ZMS_Requests.isactive, true), a!save(ri!ZMS_Requests.isapproved, false), a!save(ri!ZMS_Requests.approvalrequired, false), a!save(ri!ZMS_Requests.overbudget, false), a!save( ri!ZMS_Requests.requestname, cons!ZMS_REQUEST_STATUS[1] ) }, style: "PRIMARY" ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: true, saveInto: ri!cancel, submit: true, style: "NORMAL", validate: false ) } ) ) )
Hi Shubham, Lets say you want to refresh the value for field "animalName", then your code would be like below,
a!radioButtonField( label: "Request Type", labelPosition: "ABOVE", choiceLabels: local!reqTypes, choiceValues: local!reqTypes, value: ri!ZMS_Requests.requesttype, saveInto: { ri!ZMS_Requests.requesttype, if( ri!ZMS_Requests.requesttype="Equipment", { a!save(ri!ZMS_Requests.animalName,null) }, {} ) } required: true, requiredMessage: "please select request type", choiceLayout: "COMPACT", choiceStyle: "STANDARD", validations: {} )
In the same way you can make null other fields as well when user changes value from "animal" to "Equipment"
Thanks a lot alot alot alot ...
No problem.