Click here to Skip to main content
15,887,746 members
Home / Discussions / JavaScript
   

JavaScript

 
Questionfunctions Pin
Member 1183686414-Jul-15 5:52
Member 1183686414-Jul-15 5:52 
AnswerRe: functions Pin
Shmuel Zang14-Jul-15 18:46
Shmuel Zang14-Jul-15 18:46 
AnswerRe: functions Pin
Member 1184785019-Jul-15 12:31
Member 1184785019-Jul-15 12:31 
QuestionFile Upload doesn’t work on Mobiles Pin
Praveen Raghuvanshi13-Jul-15 6:57
professionalPraveen Raghuvanshi13-Jul-15 6:57 
QuestionBlob went away in IE 11? Pin
dbrenth10-Jul-15 10:06
dbrenth10-Jul-15 10:06 
Questionbrowser version detection window 7 machine and IE version 11 Pin
Member 118062861-Jul-15 5:39
Member 118062861-Jul-15 5:39 
AnswerRe: browser version detection window 7 machine and IE version 11 Pin
Richard Deeming1-Jul-15 7:52
mveRichard Deeming1-Jul-15 7:52 
Questionin MVC Edit page, how to check for null values? Pin
Member 1173386829-Jun-15 11:28
Member 1173386829-Jun-15 11:28 
JavaScript
<script>
    $(window).load(function () {

      if ($('#TTest1').val(null)) {       $('#TTest1').val("No"); }
</script>


Somewhat new to mixing in javascript or jquery into html, The goal is to test the values being passed into the form, and on some of those, if they are null? make the value = "No".

The result above is hit or miss, it sometimes works and usually does not. I can see the value coming from the sql management studio is null, i can put an alert within the test in my IF statement, and it never fires the message.

but another set of variables using the exact same syntax works fairly well. My question is how to manipulate the variable so that it tests it reliably and can set the value to string "No" if null?

I wondered if its doing a double-reference and because of this producing invalid results? i mean the statement tests the variable then writes it?

the variables are passed in from the c# view, and the edit form can change then submit and they get updated in the database. Well there seems to be some challenge in looking at a variable and testing it to be null.

javascript is ok to use it just has to be reliable and work every time.
AnswerRe: in MVC Edit page, how to check for null values? Pin
Richard Deeming30-Jun-15 1:22
mveRichard Deeming30-Jun-15 1:22 
GeneralRe: in MVC Edit page, how to check for null values? Pin
Member 1173386830-Jun-15 17:01
Member 1173386830-Jun-15 17:01 
GeneralRe: in MVC Edit page, how to check for null values? Pin
Afzaal Ahmad Zeeshan30-Jun-15 22:10
professionalAfzaal Ahmad Zeeshan30-Jun-15 22:10 
GeneralRe: in MVC Edit page, how to check for null values? Pin
Member 117338681-Jul-15 13:46
Member 117338681-Jul-15 13:46 
GeneralRe: in MVC Edit page, how to check for null values? Pin
Afzaal Ahmad Zeeshan1-Jul-15 14:50
professionalAfzaal Ahmad Zeeshan1-Jul-15 14:50 
GeneralRe: in MVC Edit page, how to check for null values? Pin
Richard Deeming1-Jul-15 1:17
mveRichard Deeming1-Jul-15 1:17 
GeneralRe: in MVC Edit page, how to check for null values? Pin
Member 117338681-Jul-15 13:56
Member 117338681-Jul-15 13:56 
AnswerRe: in MVC Edit page, how to check for null values? Pin
Afzaal Ahmad Zeeshan30-Jun-15 22:07
professionalAfzaal Ahmad Zeeshan30-Jun-15 22:07 
GeneralRe: in MVC Edit page, how to check for null values? Pin
Member 117338681-Jul-15 13:40
Member 117338681-Jul-15 13:40 
GeneralRe: in MVC Edit page, how to check for null values? Pin
Afzaal Ahmad Zeeshan1-Jul-15 14:49
professionalAfzaal Ahmad Zeeshan1-Jul-15 14:49 
GeneralRe: in MVC Edit page, how to check for null values? Pin
Member 117338681-Jul-15 15:01
Member 117338681-Jul-15 15:01 
Questionexternal javascript not working Pin
nordyck29-Jun-15 7:31
nordyck29-Jun-15 7:31 
AnswerRe: external javascript not working Pin
Kornfeld Eliyahu Peter29-Jun-15 8:13
professionalKornfeld Eliyahu Peter29-Jun-15 8:13 
GeneralRe: external javascript not working Pin
Member 1173386829-Jun-15 12:47
Member 1173386829-Jun-15 12:47 
AnswerRe: external javascript not working Pin
Leng Vang2-Jul-15 9:38
Leng Vang2-Jul-15 9:38 
Questionjquery slideshows Pin
vikkismarty29-Jun-15 5:21
vikkismarty29-Jun-15 5:21 
QuestionStore one value from rows of data in a table Pin
Rajesh_198025-Jun-15 3:29
Rajesh_198025-Jun-15 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.