Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Browse screen

johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: Browse screen

Unread post by johan »

Max,

I use my #browseTable# in a lookup on a subform (http://forums.nubuilder.cloud/viewtopic.p ... 931#p11931).
When I add your suggestion I always get message 'not available') and go back to the browsescreen of the form.
I think I have to add some JavaScript on my subform.

Johan
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Browse screen

Unread post by massiws »

Johan, sorry but I made an error in my previous post: the code must be placed in Custom Code > Before Open (I correct it now).
johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: Browse screen

Unread post by johan »

Max,

I've tried before open but this doesn't work. (or I do something wrong)
I don't open the form Books (go to editscreen). I only use the browsescreen of the form BOOKS to choose books in my lookup.

In that browsescreen (BOOKS) i have a column available / not available.
What I wan't is an alert when user selects a book that is not available.

Johan
johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: Browse screen

Unread post by johan »

Max,

I've created a function to check if the field in column actief = 2

Code: Select all

function checkfree(pthis){
PRE       = pthis.name.substring(0,13);

    if (Number(document.getElementById(PRE+'res_actief').value )= '2'){
    alert('Dit boek is niet beschikbaar in deze periode');
    }}
I want to run it when lookup is changed. When I put checkfree(this) in the all tab - onchange of the lookup nothing happens. Any idea how I can activate it when lookup is changed.
Thanks
Johan
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Browse screen

Unread post by massiws »

Johan, have you tried to insert that function in Javascript field in Lookup tab?
johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: Browse screen

Unread post by johan »

Max,
I've tried several options but all of them giving errors.

Tried to just paste the code above (nothing happens),
refer to it with nuSreen.checkfree(this)
ScreenShot002.png
and edit the code to

Code: Select all

if (Number(nuGetRow('res_actief').value )= '2'){
  alert('Dit boek is niet beschikbaar in deze periode');
   }
With last code I get error
ScreenShot001.png
Any idea?

Johan
You do not have the required permissions to view the files attached to this post.
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Browse screen

Unread post by massiws »

Johan, try this:

Code: Select all

var fieldID = nuGetRow() + res_actief;
if ( $('#'+fieldID).val() == '2') {
    alert('Dit boek is niet beschikbaar in deze periode');
};
johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: Browse screen

Unread post by johan »

Max,

It works with this code:

Code: Select all

var fieldID = nuGetRow() + 'res_actief';
if ( $('#'+fieldID).val() == '2') {
    alert('Dit boek is niet beschikbaar in deze periode');
};
Thanks a lot for your help.
Johan
johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: Browse screen

Unread post by johan »

Max,

Still have 1 question :oops:

Now I get the alert but if i click on ok of the alert the book is still selected.
How can I prevent to select that book in my lookup?

johan
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Browse screen

Unread post by massiws »

Johan, add this after the alert():

Code: Select all

window.history.go(-1);
Max
Locked