Page 1 of 1
nuForm accesing object by name and not ID
Posted: Thu Jun 27, 2024 3:33 pm
by Giu
nuForm function works in this way:
Code: Select all
nuForm('664e4e6451cfbe7', primaryKey, '', '', '1');
But there are a some of important issues using the ID instead of name.
- You can't identify wich form is called.
- You can't search forms by ID.
- You have to open the form, inspect it and see the iD to reference it.
I suggest to change for the unique name of the form.
Re: nuForm accesing object by name and not ID
Posted: Thu Jun 27, 2024 4:23 pm
by kev1n
Unlike form codes, which may be subject to changes, IDs provide a stable reference point.
Despite the benefits of using IDs, I acknowledge the challenges mentioned regarding the identification and searchability of forms by their IDs alone.
To address these concerns, while maintaining the stability of using IDs and also backwards compatibility, nuForm() could be modified to accept a parameter in the format
Code: Select all
nuForm('code:form_code_here', primaryKey, '', '', '1')
What do you think?
Re: nuForm accesing object by name and not ID
Posted: Thu Jun 27, 2024 4:54 pm
by Giu
I think this is so elegant
Re: nuForm accesing object by name and not ID
Posted: Fri Jun 28, 2024 6:57 am
by kev1n
You can now find this update on
Github.
Consider replacing your current nuform.php with the version from Github.
This update enables you to call a form using the traditional method, using the form ID:
Code: Select all
nuForm('62d91e8f4adbbc7 ', '-1', '', '', '1')
Alternatively, you can call a form using a first parameter that starts with "code:" followed by the form's code:
Code: Select all
nuForm('code:myformcode', '-1', '', '', '1')
Documentation
Re: nuForm accesing object by name and not ID
Posted: Fri Jun 28, 2024 11:07 am
by Giu
Thanks