Page 1 of 1

Button Style and Cancel action

Posted: 06 Jan 2018
by 2xdutchAZ
Could somebody help me with customizing the Button Style and OnClick action of a new CANCEL button. i'm using V3.1.4

I've found various pieces of CSS code but it's not applying it to my new "CANCEL" button, which should be bigger and have a distinct color.
I've only seen that I can adjust the width, but not the height.

This form is a sub-form which is opened from another (main) form I use for navigational purposes using the "Related Items" control.
Once this subform is opened and user decided to cancel then - When new cancel button is clicked - it should exit the sub-form (without saving) and go back to the main form, which i use for navigation.

i'm using the code below "onclick" for SAVE - but can't get it to work when somebody clicks CANCEL
fd.onsubmit(function() {
fd.sourceFormParam('fd_Item_DisplayForm.aspx?ID=' + GetUrlKeyValue('ID'));
return true;
});


Much appreciated!

Re: Button Style and Cancel action

Posted: 07 Jan 2018
by Nikita Kurguzov
Hello!
Yeah, what you describe is possible. The button doesn't have a Height property unlike Width, but there is a Style property where you can put any style specific to the element. It works exactly like HTML style attribute, so you just place everything inside without classes or brackets.
CancelButton.png
CancelButton.png (7.57 KiB) Viewed 1935 times

So, the style tag could just contain this line, for example:

Code: Select all

height: 250px;
The OnClick property can have this piece of code to redirect users to Display Form without saving changes, just make sure to save Display Form in Forms Designer first:

Code: Select all

var FormID = GetUrlKeyValue("ID");
fd.openForm('fd_Item_DisplayForm.aspx', {ID: FormID});

Re: Button Style and Cancel action

Posted: 08 Jan 2018
by 2xdutchAZ
Got it to work - Thanks! Great Support.

For those that want to follow this solution, please note that I clicked the "BUTTONS" icon to add the regular SAVE and CANCEL buttons at the bottom.

Then you have to add a new "Button" and call it "cancel" and add the code to the Onclick field. (fd_Item can also be fd_task depending on what type of list you use).

Then you can delete the original Cancel button. Hope it helps.