msgbox functionality for web application?

For questions and postings not covered by the other forums
Rich Cassell
Posts: 77
Joined: Mon Aug 24, 2009 11:22 pm
Location: Nottinghamshire, UK

msgbox functionality for web application?

Postby Rich Cassell » Tue Nov 16, 2010 9:56 pm

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

User avatar
Jade Support
Posts: 103
Joined: Mon Aug 17, 2009 10:27 am
Location: Jade Software Corporation, Christchurch

Re: msgbox functionality for web application?

Postby Jade Support » Tue Nov 16, 2010 10:27 pm

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,
Jade Support
Jade Software Corporation Ltd

Email: jadesupport@jadeworld.com
Web: http://www.jadeworld.com

Jade Software – complex business problems solved beautifully.

Rich Cassell
Posts: 77
Joined: Mon Aug 24, 2009 11:22 pm
Location: Nottinghamshire, UK

Re: msgbox functionality for web application?

Postby Rich Cassell » Tue Nov 16, 2010 10:36 pm

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

allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Re: msgbox functionality for web application?

Postby allistar » Wed Nov 17, 2010 8:00 am

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.

Rich Cassell
Posts: 77
Joined: Mon Aug 24, 2009 11:22 pm
Location: Nottinghamshire, UK

Re: msgbox functionality for web application?

Postby Rich Cassell » Thu Nov 18, 2010 10:37 pm

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

davidmellow
Posts: 42
Joined: Thu Aug 27, 2009 1:27 pm
Location: New Plymouth, New Zealand

Re: msgbox functionality for web application?

Postby davidmellow » Thu Feb 17, 2011 3:41 pm

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.

Rich Cassell
Posts: 77
Joined: Mon Aug 24, 2009 11:22 pm
Location: Nottinghamshire, UK

Re: msgbox functionality for web application?

Postby Rich Cassell » Fri Feb 25, 2011 11:10 pm

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


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests