Page 1 of 2
Add 2 button to the rows of the browse form
Posted: Sun Jan 31, 2021 10:00 am
by calida
hi, is there the possibility to add 2 buttons to the rows of the browse form?
I would like to press the first button to open the edit form of the selected record, pressing the second to open another form browse with the records related to the selected record
Re: Add 2 button to the rows of the browse form
Posted: Sun Jan 31, 2021 11:03 am
by kev1n
Hi,
Are you familiar with JavaScript?
There's an article in the Code Library that shows how to add a button to each row of a Browse Form:
https://github.com/smalos/nuBuilder4-Co ... te_buttons
Re: Add 2 button to the rows of the browse form
Posted: Sun Jan 31, 2021 11:34 pm
by steven
calida,
If you know Javascript this might help.
It adds an Edit Button to the first column of a Browse/Lookup.
Code: Select all
for(var i = 0 ; i < 20 ; i++){
if($('#nucell_' + i + '_1').html() != ''){
$('#nucell_' + i + '_0').html('<input type="button" id="edit' + i + '"class="nuActionButton" value="Edit" onclick="editBuildType(event)">');
}
}
function editBuildType(e){
var p = e.target.id.substr(4)
$('#nucell_' + p + '_0').prop("onclick", null).off("click");
var pk = $('#nucell_' + p + '_0').attr('data-nu-primary-key');
nuForm('600cc03b4195b7f', pk, '', '', '1');
}
Steven
Re: Add 2 button to the rows of the browse form
Posted: Mon Feb 01, 2021 5:34 am
by apmuthu
Should we not have a button on the form designer to add buttons with standard options like Delete, Edit, Popup (with parameters), etc - a sort of a wizard or standard form to add them in?
This way we can leverage some standard functions to generate them instead of custom JS each time.
Re: Add 2 button to the rows of the browse form
Posted: Tue Feb 16, 2021 12:31 am
by icoso
apmuthu wrote:Should we not have a button on the form designer to add buttons with standard options like Delete, Edit, Popup (with parameters), etc - a sort of a wizard or standard form to add them in?
This way we can leverage some standard functions to generate them instead of custom JS each time.
Great Idea! Also How can I either disable or delete a button once I add it.
I have a form that all fields are disabled when you first open it (view only). For example: I have a function that deletes the clone button, via: $('#nuCloneButton').hide(); Then I add two buttons: One to duplicate the current record and one to just edit the current record.
nuAddActionButton('DupMyForm', 'Duplicate MyForm', 'clearFields("cust_billdate|cust_retdate")');
nuAddActionButton('EditMyForm', 'Edit MyForm', 'clearFields("NO")');
My clearfields() function will either clear out some fields after I click DupMyForm or NOT if I just click the EditMyForm button.
If I click my DupMyForm Button, I'd like to disable it afterwards or hide it. Same with the Edit Button. Don't want the user to get to click happy.
Doing this: $('#DuMyForm').hide(); OR nuDisableAllObjects(); OR nuDisable('DupMyForm'); does not work to disable the buttons.
Also, I'd like to add a Title to the page that Shows Im "Editing" or Duplicating" so the user has an idea what they clicked. Any IDea how to do that would be appreciated.
Re: Add 2 button to the rows of the browse form
Posted: Tue Feb 16, 2021 4:25 am
by kev1n
Use nuDisable() to disable objects.
Where should this "Title" be displayed?
Re: Add 2 button to the rows of the browse form
Posted: Wed Feb 17, 2021 1:16 am
by icoso
kev1n wrote:Use nuDisable() to disable objects.
Where should this "Title" be displayed?
Kevin, I've tested with nuDisable(): "Doing this: $('#DuMyForm').hide(); OR nuDisableAllObjects(); OR nuDisable('DupMyForm'); does not work to disable the buttons. "
As with any web page, usually a page has a text title. I'd like it to appear on the Form just above the fields on the page. I could do it with a <div> on the Form page itself and just hide or display it using java script on a regular web page. BUt I don't know how to put a text field (not one that needs to be saved in the dB) on the form itself.
Any ideas would be helpful...
Re: Add 2 button to the rows of the browse form
Posted: Wed Feb 17, 2021 6:52 am
by kev1n
To disable the save button:
To disable the clone button:
To disable the delete button:
Re: Add 2 button to the rows of the browse form
Posted: Wed Feb 17, 2021 6:57 am
by kev1n
icoso wrote: BUt I don't know how to put a text field (not one that needs to be saved in the dB) on the form itself.
Just create a new object to the form an give it any ID.
icoso wrote:As with any web page, usually a page has a text title. I'd like it to appear on the Form just above the fields on the page.
Where exactly should this title appear? At position 1,2,3 or somewhere else?
where.png
Re: Add 2 button to the rows of the browse form
Posted: Wed Feb 17, 2021 8:21 pm
by icoso
I should be able to put a title or text object on the form itself that is not associated with a DB field that I can hide or unhide or change appropriately.
Example-FormTitle.png
I tried just adding a display field but it wants an ID that attached to the database.
Screenshot-Save Display Text.png
With a Javascript <div id=whatever> I can typically hide or unhide it using javascript. I just want to display something on the screen when the user is either EDITING or has CLONED a RECORD. This is just to warn them that Hey you're changing something and need to save it or exit out. For example: If the user is looking at a display only form and hits Edit then I want this title to appear and state: "You ARE EDITING AN EXISTING RECORD. Make your changes and click SAVE to save your changes or EXIT to NOT save your changes."
But if they click duplicate:
"You have DUPLICATED AN EXISTING RECORD. YOu must change the Billing & Filing Date and click SAVE to save your changes or EXIT to NOT save your changes."
Its just a text box on the form to use as an instructional thing as the user does something.