viagra softtabs information 0.2mg propecia kopen nexium 40 mg generic diflucan tablet cialis tablets germany prospecto cialis 40 mg viagra uses tamil cost propecia singapore cost lexapro au aurochem cialis buy valtrex cause acne lexapro plus wellbutrin costco viagra coupon 100mg viagra split prednisone 10 mg identification propranolol generic lek lisinopril uk 10 mg lexapro enough cialis overnight Canada buspar muscle cramps propecia cheap hair much xenical buy on line in the usa lasix causes hyperkalemia Online Prescriptions bactrim suspension mexico clomid walgreens price online canada wellbutrin 150 mg kullananlar zovirax ointment price pink viagra online online hawaii generic viagra buy india ervaringen clomid 100mg prednisone steroid 5mg doxycycline for pus diflucan sinusitis nexium haittavaikutukset start zoloft 50 mg price levitra costco cialis 10 mg preisvergleich viagra customs switzerland online kauf viagra prednisone cause schizophrenia 200mg de viagra cipla cialis 2.5 mg propecia 5 mg buy zoloft line online cialis rx iodine versus synthroid augmentin causes gas long time side effects nolvadex legal uk anhydrous lisinopril usar viagra jovem valtrex generico doxycycline philippine price fastest uk delivery veterinary prescription lasix propranolol cause diarrhea nexium 40 mg inj buspar and phenibut zithromax keuhkoputkentulehdus buy viagra user cipro 750 mg kullanimi 10mg cialis effect zovirax versus valtrex cheap pills cialis levitra aus spanien sainsburys diflucan tablet where can i buy medication zithromax used dosage levitra 20mg lasix tinnitus usual dosage celebrex cipro suspension oral nexium astrazeneca 40 mg 28 diflucan tablets dose online viagra advertisement zithromax azithromycin uk http://www.bofix.at/index.php/Pharm247-cialis-da-20mg.php cialis cost everyday levitra bayer 20mg tetracycline muscle aches clomid costs canada prednisone 5 mg tabs uses medication diflucan 10 mg ml trusted online pharmacy cheap viagra uks purchase levitra discount order cialis cheap bactrim doxycycline together viagra pills pfizer nausea on cipro viagra shop uk doxycycline nausea doryx russie cambrioleur viagra lactobacillus susceptibility doxycycline costco cialis 5mg la pillola cialis lisinopril hctz target buspar m 10 xenical nuspojave viagra black online ontario viagra prescription http://www.bofix.at/ beli generic priligy doxycycline intrapleural use http://www.bofix.at/index.php/Pharm247-costo-bactrim-f.php valtrex the pill celebrex annual sales xenical price dubai clomid without menstruation doxycycline cheapest generic no prescription muscle soreness lisinopril effets levitra 40 mg lexapro 20 mg dosage robust or viagra amoxil tablets dosage 150 mg of viagra can you take daily cialis 20mg cpr 4 awp cialis 20mg kamagra pills wiki lasix cause hyponatremia generic australia walgreens lisinopril 10mg lisinopril cost drug lisinopril cost canada fuking with viagra doxycycline mono 50 mg viagra pills ladies generic viagra image tadalafila cialis 5 mg erythromycin thiocyanate buyer viagra 100 mg pdr augmentin charakterystyka produktu india viagra prezzo celebrex 200 mg wellbutrin buspar anxiety diflucan one thrush viagra australia pfizer viagra pfizer brand cipro antibiotic nausea zithromax drug recall cialis walgreens price http://www.bofix.at/ xenical 120 mg tid viagra generico tipos nexium 40 mg pricing buspar mental clarity viagra prices sweden can buy online amoxil 50 mg pct buy lexapro in canada kamagra recreational use acne cause propecia buy viagra authentic amoxil use pregnancy buspar klonopin generic lexapro 5 mg
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 18, 2015, 07:05:06 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 1342 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: 7403



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: 7403



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: 7403



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: 1050



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