viagra pfizer controversy levitra 40 mg mastercard my cialis rx cipro forms online viagra online thai effetti abuso cialis erythromycin capsules 250mg pfizer viagra 100 wirkung walgreens online cialis nolvadex kaufen wo cialis price osco get zoloft wellbutrin 75 mg tablet propecia 0.5mg results hydrochlorothiazide capsules 12.5 mg nolvadex plus arimidex tab levitra 20 mg buspar interaction alcohol welchol plus metformin taking viagra dangerous wellbutrin 150 mg bula zovirax 400mg dosage walmart viagra pharmacy finpecia finasteride 1mg generic lexapro alcohol white viagra pills cialis price eur pfizer viagra 100 wirkung http://www.bofix.at/index.php/Pharm247-use-viagra-sildenafil.php uterus lining clomid propecia ireland buy cialis 20 mg prescription cialis prices worldwide people taking buspar buy propecia overseas wordpress viagra virus doxycycline uk price best place to buy online cialis price china pills online in the india viagra generika online cialis 20mg 4 dosierung target and levitra much generic wellbutrin diflucan 150mg upotreba prices at costco cialis price dubai buy online from usa lasix causes hyperkalemia lisinopril 20 mg hypertension propecia ireland buy cialis a cukrzyca augmentin zawiesina 125 mg get off zoloft doxycycline biogaran 100mg buy viagra discount pills buy cytotec 200 mcg used order viagra free viagra apotheke online generic cialis thailand cipro 750 mg prescription medicine cipro buspirone versus prozac viagra generico curitiba glucophage 850 mg tablets nexium prices walmart cialis samples canada doxycycline tablets chlamydia sildenafil dapoxetine cheap seroquel vs buspar cipro causing vomiting lasix 40 mg pill much generic nexium periactin 4mg maroc ttc husband zoloft ordering on line 150 mg viagra paypal tablete cialis tadalafil viagra annual sales levitra 40 mg paypal lisinopril 20 mg 25 hctz sildenafil 50 mg viagra oder mg tablets of wellbutrin 300 nausea viagra usa shop farmaco priligy 30 mg cialis 2 5 e 5 mg tetracycline sumycin use usual dosage celebrex olanzapine fluoxetine price epocrates online lisinopril online from india zoloft versus valium price viagra usa getting pregnant 40 clomid cheap augmentin online viagra prices for buspar chat lexapro causes shaking wellbutrin generic pill hydrochlorothiazide cause hyperkalemia pfizer sildenafil viagra 2013 tetracycline dental uses prednisone tabs dogs viagra kaufen apotheke augmentin hautausschlag levitra de 40 mg 30 mg dosage cialis viagra to cyprus 200 mg viagra dangerous hydrochlorothiazide 12.5 mg capsule cytotec drug class cialis smooth muscle the drug synthroid augmentin tinnitus synthroid causing goiter ordering mexico cialis 50 mg prezzo liquid kamagra inaus cialis reviews generic viagra vendas online hydrochlorothiazide cause hyperkalemia prednisone usage pregnancy cheap no prescription lexapro onrustig diflucan tablets dose lisinopril abz 5 mg viagra uk illegal birth control online australia wellbutrin generic wpi 839 india labs nolvadex fushing viagra levitra de 40 mg augmentin fausse couche cialis from uk pfizer zoloft coupon metformin xl 500 mg 50 mg zoloft dose finasteride 5 mg propecia cipro 500 mg 14 tablet generic fake propecia nolvadex tablets buy cialis smooth muscle walgreens online cialis xenical online consultation viagra india name doxycycline use pregnancy over the counter canada xenical compare prices cialis drug no prescription kamagra uso diflucan foglietto illustrativo is buspar activating cheap cialis you synthroid used for wellbutrin sr 300 mg xenical uk availability finasteride propecia costo ordering viagra mexico pharmacy viagra magnus 50 mg cialis sale ireland
Home Forum Download/Upload Links Search

NetTalk User Group

NetTalk User Group Meeting!
Live Webinar!
Saturday Nov. 16 
7am PST
Click Here To Register!
Home arrow Forum arrow NetTalk Web Serverarrow Web Server - Ask For Helparrow Form Button and JavaScript Access Session Variables
NetTalk Central
April 25, 2015, 01:44:07 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the NetTalk Central Forums!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Form Button and JavaScript Access Session Variables  (Read 1347 times)
springguy
Full Member
***
Posts: 184


View Profile Email
« on: May 18, 2012, 08:06:53 AM »

Looking for general understanding/approach.

If you have a button added to a form, and when the button is clicked, you want to do some local analysis of a variable and if there is a problem with the variable data, popup an error, otherwise call a procedure or web page.

What is the best strategy for that?  Is it to call javascript before the OnClick procedure or URL call?  If so, how does the javascript access the variable NT data?  A simple, conceptual example would be helpful.

Or, is a better strategy to call a source procedure on the OnClick and depending on the clarion code there, call the appropriate procedure or web site?

Mike
Logged
Bruce
Global Moderator
Hero Member
*****
Posts: 7426



View Profile
« Reply #1 on: May 18, 2012, 09:38:44 PM »

Hi Mike,

>> If you have a button added to a form, and when the button is clicked, you want to do some local analysis of a variable and if there is a problem with the variable data, popup an error, otherwise call a procedure or web page.

This is such a common question, but unfortunately you've got it the wrong way around. Decisions are made in the _browser_ not on the server. The poppping-up-an-error is ok. To change the page you'd do something like;

p_web.Script('href.location="somepage"')

I'm not sure what you mean by "call a procedure" - the context of that you need to explain more.

Cheers
Bruce
Logged
springguy
Full Member
***
Posts: 184


View Profile Email
« Reply #2 on: May 19, 2012, 08:43:16 AM »

Thanks Bruce.

I have a specific case where I have a form with an added button.  The purpose of the button is to send an email based on information in the form data.  Using example 11, this was pretty straightforward, and works well.

However, if a data variable in the record has a certain value, then I do not want to send an email, but would rather popup a message telling the user why they cannot send an email, and then return to the form.

What I have been forced to do at the moment is to disable the button if the field value has that certain value.  That's workable, I guess, but it requires the user to understand why it is disabled, rather than the system telling them why.

So, what I am trying to get straight is when I click an added button on a Form, what is the best approach in general to do the following:

1. interrogate a variable on the record (or in a session variable)

2. have code (JavaScript I assume) that, on the basis of the variable contents, will popup a message within the browser, or...

3. call a different NT procedure or web page to do the analysis and action taking.

I don't know anything about JavaScript (yet, I suppose) to know if doing something like interrogating a value and calling for one of a multiple set of actions is possible - I assume it is, but how, and is that the best approach?

OR, is it a better approach (for us clarion guys) to have the button click call a NT source procedure that will interrogate a variable and then have it take one of a series of actions?

OR, is there a different, better approach that you would recommend. 

I would not be surprised that this is a pretty common question for us clarion guys, and I am slowly getting a better understanding of the "web programming" evironment of NT, but can you give us some practical guidance on how to interrogate a variable on a form when an added button is clicked and take a variety of actions depending on the value in the variable (ie popup, go to a NT procedure, go to a web page, etc).

Does that help clarify?
Mike
Logged
Bruce
Global Moderator
Hero Member
*****
Posts: 7426



View Profile
« Reply #3 on: May 19, 2012, 10:36:24 PM »

Hi Mike,

>> can you give us some practical guidance on how to interrogate a variable on a form when an added button is clicked

The form value is in the session queue at that point.

>> I have been forced to do at the moment is to disable the button if the field value has that certain value.  That's workable, I guess, but it requires the user to understand why it is disabled, rather than the system telling them why.

that's what "comments" are for. You can set the comment of the button to explain why it is disabled.

Cheers
Bruce

Logged
springguy
Full Member
***
Posts: 184


View Profile Email
« Reply #4 on: May 20, 2012, 04:09:22 AM »

Bruce,
I really appreciate your comments over the weekend.

I do understand that the values are in the session queue.  I think what I am asking is "can JavaScript access those values, and if so, can you give a simple example of what a piece of JS code would look like that does access a session value". If that is possible, then it opens an interesting door of possibilities in client side dynamics. 

Regarding using the comments to explain a situation, I had never thought of that as being a dynamic set of comment.  Thanks for the suggestion - I think I can run with that.
Mike
Logged
Bruce
Global Moderator
Hero Member
*****
Posts: 7426



View Profile
« Reply #5 on: May 20, 2012, 09:24:56 PM »

>> can JavaScript access those values,

no, not directly of course. the values are on the server side. To get the current value of one of them, the browser could "ask" (as in make an asynchronous request) and perhaps you have a web page that'll return that value - but there's no "GetSessionValue" function.)

also the request would be asynchronous, so it would be somewhat harder to use unless you were familiar with JavaScript callbacks etc.

cheers
Bruce
Logged
kevin plummer
Hero Member
*****
Posts: 1053



View Profile WWW
« Reply #6 on: May 20, 2012, 10:34:17 PM »

Hi Mike,

If you are just starting out in the web I wouldn't be too quick to jump in and start trying to use Javascipt. For the most part NTW protects us from that big bad world which makes the learning curve much easier. In your case the way I see it is you have 2 options. One, disable the button and use the comments field or insert a field to let the user know why the button is disable and enable the button when everything is good. Two, create a popup error form. Set the URL on your button to be dynamic (a GSV) and update this variable to be either the popup form or your email procedure. The caveat is if you can popup a form from a button from the templates. I hand coded this in NTW5 and without template support would be too complicated to work out.

Cheers,

Kev
Logged
springguy
Full Member
***
Posts: 184


View Profile Email
« Reply #7 on: May 21, 2012, 02:06:18 AM »

Thanks Bruce and Kevin,
I really appreciate your advice.
Mike
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!

Login Form

Welcome Guest.






Lost Password?
No account yet? Register
home contact search contact search