Browse screen

Re: Browse screen

Postby johan » Fri Aug 02, 2013 3:58 pm

Max,

I use my #browseTable# in a lookup on a subform (viewtopic.php?f=6&t=8266&p=11931#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
johan
 
Posts: 270
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: Browse screen

Postby massiws » Fri Aug 02, 2013 10:11 pm

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).
massiws
 
Posts: 503
Joined: Thu May 24, 2012 9:38 am
Location: Milan, Italy

Re: Browse screen

Postby johan » Fri Aug 02, 2013 11:58 pm

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: 270
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: Browse screen

Postby johan » Sat Aug 03, 2013 5:22 pm

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
johan
 
Posts: 270
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: Browse screen

Postby massiws » Sun Aug 04, 2013 1:31 am

Johan, have you tried to insert that function in Javascript field in Lookup tab?
massiws
 
Posts: 503
Joined: Thu May 24, 2012 9:38 am
Location: Milan, Italy

Re: Browse screen

Postby johan » Mon Aug 05, 2013 3:24 pm

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
ScreenShot002.png (5.48 KiB) Viewed 5790 times


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
ScreenShot001.png (7.08 KiB) Viewed 5790 times


Any idea?

Johan
johan
 
Posts: 270
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: Browse screen

Postby massiws » Mon Aug 05, 2013 10:20 pm

Johan, try this:
Code: Select all
var fieldID = nuGetRow() + res_actief;
if ( $('#'+fieldID).val() == '2') {
    alert('Dit boek is niet beschikbaar in deze periode');
};
massiws
 
Posts: 503
Joined: Thu May 24, 2012 9:38 am
Location: Milan, Italy

Re: Browse screen

Postby johan » Mon Aug 05, 2013 11:17 pm

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: 270
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: Browse screen

Postby johan » Tue Aug 06, 2013 12:29 am

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
johan
 
Posts: 270
Joined: Sun Feb 27, 2011 7:46 pm
Location: Belgium

Re: Browse screen

Postby massiws » Tue Aug 06, 2013 1:49 am

Johan, add this after the alert():
Code: Select all
window.history.go(-1);


Max
massiws
 
Posts: 503
Joined: Thu May 24, 2012 9:38 am
Location: Milan, Italy

PreviousNext

Return to Custom Code



cron