NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Koen Tjoa on November 04, 2011, 07:57:10 AM
-
I have a NetWebForm with a BrowseControl and several buttons. I would like to enable/disable a button based on the condition if records are tagged or not in the browse. In the browse procedure a SessionVariable is set with the number of tagged records.
In the NetWebForm on the Fields tab I made two settings:
1. For the button --> the entry ‘Disabled If’ reads that SessionVariable.
2. BrowseControl --> Client-Side tab --> resets the button value.
Unfortunate this isn’t working. First the Value::MyButton routine is done, then the EIP embed where the actual tagging is handled. That is the wrong order for what I want. Although the SessionVariable is updated, the button reads the old value first and is not set to state to be expected.
How can I make that the Value::MyButton routine is called after the user has tagged a record in the browse? Or maybe better said after the update of the browse control is done.
Thanks,
Koen
-
Hi Koen,
I have the same problem with trying to display the number of records tagged - the number displayed is always 1 behind for the same reason you are having problems disabling the button.
I haven't been able to find a way around it.
cheers,
kevin
-
Yep, I did a search on this forum first and I saw and old topic of you. In fact I was hoping you had solved it meanwhile.
I did some tracing to figure out what is actually happening. The browse is called several times on different threads. Mostly the Value::MyButton routine is called first and for some reason the embed where the tagging is done always “loses. I didn’t found out yet where the calling of the browse is done. That can be the key of calling the Value::MyButton routine again.
Cheers,
Koen
-
Could you put a "unique for this purpose" Class on the buttons and then have a jquery script run when a record is tagged?
-
You got me.. ???
What is a "unique for this purpose" class? I guess it must be possible to run a jquery script, although I must figure out how. But won’t it end with the same problem with running the value routine and the tagging asynchronic?
-
Koen,
What I meant by "unique for this purpose" was using the form name plus something else, eg an ID of "<formname>_TagButton".
You then use this as the jQuery selector.
With jQuery you would run code similar to here (http://jetlogs.org/2007/12/16/jquery-disabled-and-readonly-inputs/). The code is being used for an Input tag, but I'm pretty sure it works for buttons as well (http://jquery-howto.blogspot.com/2009/05/disable-submit-button-on-form-submit.html).
-
Hi Stu,
Thanks, I understand it. It must be possible to but call this JavaScript from my browse after the tagging is done. But unfortunate I cannot get it working yet here.
For trying this out I have two buttons in my form. Button ‘bTest2’ should disable ‘bTest1’. The name of the form in the IDE is ‘wF_TerugmeldingUit’, but in the browser if I got it right the name is ‘wF_TerugmeldingUit_frm’.
I tried all kind off combinations like:
'$(''wF_TerugmeldingUit_frm_bTest1'').attr(''disabled'', ''disabled'')'
'$(''.bTest1'').attr(''disabled'', true)'
But nothing works so far. So either I didn’t get the form name plus something else right in the way you meant or my JavaScript syntax is wrong.
For being sure I tried
'alert$(''Hello'')'
which is working, indicating that at least simple JavaScript works from that particular button.
What am I missing?
Thanks, again,
Koen
-
Koen,
In that first line of code, you need either a # or a .
And a semicolon at the end
Also, using double quotes helps me to see things better (but that's just my personal preference)
ie,
$("#wF_TerugmeldingUit_frm_bTest1").attr("disabled","disabled");
-
Hi Stu,
I was a long weekend off so I couldn’t respond earlier. I tried what you suggested but unfortunate it I cannot get it working. :-[
At this moment I give up, it is just a small thing to make things look nicer.
However it is much appreciated that you tried to help me to figure it out. Thank you very much.
Regards,
Koen