alert control

Post any suggestions or enhancement requests about the Verj.io platform or this Forum

Moderators: Jon, Steve, Ian, Dave

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

alert control

#1

Postby Segi » Fri Feb 05, 2016 10:57 pm

I would really like to have a customizable control that can be used to display an alert message to the user.

For example if I want to display a message to the user that the table has been updated I would like to be able to do fields.ALERTCONTROL.value="The table has been updated" then fields.ALERTCONTROL.show() to display a dialog with an ok button that halts execution of the server side javascript script until the user clicks on OK.

The only way that this can be done in the moment is by using an HTML control which is really awkward and has issues that come up occasionally.

Even better, it would be nice to have a way to specify the controls button so I can say that I want the dialog to display an OK button and a cancel button with the ability to determine which one was clicked. This can all be done easily on the client side javascript but not server side.
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#2

Postby Steve James » Sun Feb 07, 2016 9:09 am

Hi Segi, my immediate reaction was great idea. It is a good idea but it is easy enough in v501 (especially now you can add web resources easily).

I had to do something like this with a GIS application in v4 and ended up with the dialog logic outside of Ebase as it was so cumbersome (or my brain couldn't get the right logic within Ebase).

Rather than thinking about it as a server side script that I wanted to branch based on a user input; I pushed the logic client side with appropriate executefunctions to run the server side stuff.

Hidden panel for the dialog.
Standard Ebase button no events but click event handler added to run function in web resource (saves having to Ctrl+H all the time to edit). Also as Ebase is all file based now it means that Chrome workspace should be able to be used (ie edit the js file in Chrome rather than Ebase designer and have to relaunch form every time).

- executefunction do update and return value
- show dialog based on result (dynamically appending the div to the body instead of having it cluttering the source)
- wait for client input
- executefunction based on input received.

The power of jquery-ui means that it is easy enough to configure multiple buttons in the dialog; icons instead of text; close on escape =false etc etc.

Thanks, I've been meaning to look at dialogs again but hadn't got round to it.
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

#3

Postby Segi » Mon Feb 08, 2016 4:35 pm

I have thought about doing this with this approach where you do the legwork on the client side but the problem is that its difficult to quickly add this functionality to each project that needs it which is why I was hoping for something that can be easily called from anywhere by having the framework set up on the server side only.
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#4

Postby Steve James » Mon Feb 08, 2016 8:28 pm

Hi Segi, yes I wonder whether Ebase would say add the resources to the presentation template so they just get picked up by the template rather than having to add them to each form. I rarely look at presentation templates as I do not want to break old forms. It is easy to add jquery/ui/client side scripts to a presentation template but then all forms pick them up.

Maybe there needs to be some sort of separation in presentation templates so we can easily add a group of resources?

client script

Code: Select all

function showdialogOKCancel(title,preDiaFN,postDiaFNOK,postDiaFNCancel)
{
	var theTitle = title // or $eb.getFieldValue(title);
	var theDialogContent = $eb.executeFunction(preDiaFN);
	$( "#dialogdiv" ).html( theDialogContent);
	$( "#dialogdiv" ).dialog({
			title: theTitle,
			closeOnEscape: false,
			dialogClass: 'no-close',
      modal: true,
      buttons: [
    {
      text: "Ok",
      icons: {
        primary: "ui-icon-check"
      },
      click: function() {
					$eb.executeFunction(postDiaFNOK, null,true);
        $(this).dialog( "destroy" );
      },
      showText: false
    },
    {
      text: "Cancel",
      icons: {
        primary: "ui-icon-closethick"
      },
      click: function() {
				$eb.executeFunction(postDiaFNCancel, null,true);
        $(this).dialog( "destroy" );
      },
    }    
  ]
 });
}
server side script

Code: Select all

function preDiaSvrSide()
{
	// do some processing....
	fields.f1.value = system.variables.$SYSTEM_DATETIME.value;
	// return the result/dialog content.
	return "Content for dialog, return a load of blurb<br><br><strong>including markup</strong>";
&#125;


function postDiaSvrSideOK&#40;&#41;
&#123;
	controls.message1.addErrorMessage&#40;"you pressed OK"&#41;;
&#125;

function postDiaSvrSideCancel&#40;&#41;
&#123;
	controls.message1.addErrorMessage&#40;"you pressed Cancel"&#41;;
&#125;

Then all you need is a simple call function in the html element properties instead of the normal event.

Code: Select all

showdialogOKCancel&#40;'dialog title','preDiaSvrSide','postDiaSvrSideOK','postDiaSvrSideCancel'&#41;;
return false;
Very easy and quite reusable but
1 - I agree a server side alert control (or dialog control) would be very useful.
2 - I think there should be a mechanism to group web resources outside of property sets.
0 x


Who is online

Users browsing this forum: No registered users and 2 guests