Page 1 of 1

msgbox functionality for web application?

Posted: Tue Nov 16, 2010 9:56 pm
by Rich Cassell
Hello,

In a Web Application (JADE Forms), is there any way of displaying a prompt to the user with a "Yes" / "No" option?

Currently, we do have message labels that display validation errors etc, but we need to show something to the user even when the data is valid. The idea being they enter data, press "OK", the prompt appears, they answer to exit the screen. Using our current technique means displaying anything on the error line is pointless as they are leaving the screen anyway...

I am after functionality similar to the app.msgbox() class for the thin client. Is this possible? :?

Cheers,

Rich

Re: msgbox functionality for web application?

Posted: Tue Nov 16, 2010 10:27 pm
by Jade Support
Hi Rich,

You can use the Application::msgBox() method, but it won't display as a message box dialog outside of the client's browser window. Instead it'll be a new 'form' in the browser.

It may be possible to achieve such behaviour using Javascript but I don't have any examples on how to do this. Other users on the forum may have experience in this area.

Regards,

Re: msgbox functionality for web application?

Posted: Tue Nov 16, 2010 10:36 pm
by Rich Cassell
Hey!

Thanks for your reply.

Sorry, my original post wasn't really clear. I have already attempted to use the Application::msgBox functionality but as you said, rather than being a prompt it was a new (rather un-user friendly) html page. I am hoping for more of a prompt ability the way that the msgBox works in a thin client environment.

Javascript is an option if anybody has used it for this purpose?

Thanks!

Rich

Re: msgbox functionality for web application?

Posted: Wed Nov 17, 2010 8:00 am
by allistar
There are various examples on the web on how to mimic a modal dialog in a web application. An example is here:

http://luke.breuer.com/tutorial/javascr ... ialog.aspx

The idea is that you put a centred div on the page with the modal dialog content, and apply a mask to the remainder of the page which effectively grays it out. For certain browsers you need to disable all input controls (in particular SELECTS). This is all done in javascript. I can't help much with tying this into a Jade application as I don't use the Jade webforms framework to expose Jade applications to the web for my Jade/web projects.

Re: msgbox functionality for web application?

Posted: Thu Nov 18, 2010 10:37 pm
by Rich Cassell
Hi allistar!

Thanks for the link and guidance. I shall give that a go and see how i get on! I will update the thread with code if it works smoothly.

Cheers!

Rich

Re: msgbox functionality for web application?

Posted: Thu Feb 17, 2011 3:41 pm
by davidmellow
Haven't done it with Jade, but I'd explore some of the JQuery freebies floating around. I've seen some quite cool classes that have the functionality you're after.

I've been looking at JQuery more in relation to .NET web projects - with .NET web development going more in the direction of MVC, JQuery seems a lot better than the .NET Ajax controls that were more suited to ASP.NET forms. Some nice stuff out there from what I can see and I doubt if it is too complicated incorporating them into Jade forms? Not sure, haven't done it, but worth looking at maybe.

Re: msgbox functionality for web application?

Posted: Fri Feb 25, 2011 11:10 pm
by Rich Cassell
Hi all,

Just to update this thread, we are still trying to find a way of having a "Yes/No" message box functionality on our Web-Enabled JADE Forms. However, we have managed to use Javascript (which we're playing with elsewhere) to have a standard "OK" messagebox appear.

The javascript sits in a createUserScript method which is called from the load method of the current form. You can use web event mappings to trigger the script when a control is clicked.

The code is :

Code: Select all

function validate_box(box) { var exp; var result; var prop; prop = document.getElementsByName(box).item(0); if (prop != null && prop.value.length > 0) { exp = /-?\d{1,10}(\.\d{1,2})?/; result = prop.value.match(exp); if (result != null) { if (result[0] != prop.value) { try { prop.focus() } catch(e) {} window.alert('Value not in a valid format'); return 1; } } else { try { prop.focus() } catch(e) {} window.alert('Value not in a valid format'); return 1; } } return 0; }

This example validates a textbox to ensure what has been entered is in the right format (Decimal[10,2] in this case). If not, the alert is raised, otherwise the button click event is run as normal.

Rich