Topic Wiki

Training
Codecademy.com offers hand on courses for  various coding languages including HTML, JavaScript, CSS, and more. FREE
TreeHouse.com 8)
w3schools.com
regex

Resources
Browser compatibility
Can i use

To test/show-of your skills
html - css - js
http://codepen.io/pen/
http://jsfiddle.net/

My sql
www.sqlfiddle.com

Editor
notepad-plus-plus.org/

android development
http://developer.android.com/sdk/index.html

js librery
http://greensock.com/ nice animation
getbootstrap.com/css/ responsive layout
jquery.com do more write less

Free Books
http://it-ebooks.info/

Test client browser version
http://browser-update.org/
« Last edited by yesitsme on May 17, 2015, 11:13:37 AM »

Author Topic: Programming for Beginners  (Read 108404 times)

Offline AnonymousUser

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: Feb 2013
  • Posts: 3002
  • Total likes: 13
  • DansDeals.com Hat Tips 0
    • View Profile
Re: Programming for Beginners
« Reply #320 on: November 19, 2015, 09:50:25 PM »
So something simple, but can't figure it out

I created a input field on a form but I need the value to be what the user entered. How can I do that.

Ie. He enters 300, then the value becomes 300. And so, when the user enter $300.00 then that value goes right away in another field automatically.

TIA
You're being kind of vague. Do you mean on an HTML webpage? And do you mean that as soon as the user enters a value into a textbox, aside element should reflect that value?

Offline 1050BU

  • Dansdeals Gold Elite
  • ***
  • Join Date: Sep 2015
  • Posts: 154
  • Total likes: 1
  • DansDeals.com Hat Tips 1
    • View Profile
Re: Programming for Beginners
« Reply #321 on: November 19, 2015, 10:25:36 PM »

You're being kind of vague. Do you mean on an HTML webpage? And do you mean that as soon as the user enters a value into a textbox, aside element should reflect that value?

Yes html.

When the user enters a number in a text input,  I need another box to have that same number.

Offline bubbles

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Jul 2011
  • Posts: 5082
  • Total likes: 20
  • DansDeals.com Hat Tips 67
    • View Profile
Re: Programming for Beginners
« Reply #322 on: November 19, 2015, 10:56:36 PM »
Can't say I'm the expert here but...

would something like this work for you? Obviously swapping out the correct id's.

Code: [Select]
$(function(){
    $("#input").keyup(function() {
            $("#display").text( $("#input").val() );
    });   
});


Offline smurf

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: Sep 2010
  • Posts: 4554
  • Total likes: 300
  • DansDeals.com Hat Tips 8
    • View Profile
  • Location: NJ
Re: Programming for Beginners
« Reply #323 on: November 20, 2015, 12:58:34 AM »
Yes html.

When the user enters a number in a text input,  I need another box to have that same number.
assuming input fields are id'd as input1 and input2
Code: [Select]
$('#input1').keyup(function (){
$('#input2').val(this.val())
})


Offline JoeyShmoe

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Nov 2014
  • Posts: 1286
  • Total likes: 254
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
Re: Programming for Beginners
« Reply #324 on: November 20, 2015, 10:16:48 AM »
Code: [Select]
$(function(){
    $("#input").keyup(function() {
            $("#display").text( $("#input").val() );
    });   
});
Code: [Select]
$('#input1').keyup(function (){
$('#input2').val(this.val())
})

FYI both responses are assuming that you are using jQuery.
DDF A-Z Link Extension
Chrome
Firefox
Info

Offline 1050BU

  • Dansdeals Gold Elite
  • ***
  • Join Date: Sep 2015
  • Posts: 154
  • Total likes: 1
  • DansDeals.com Hat Tips 1
    • View Profile
Re: Programming for Beginners
« Reply #325 on: November 20, 2015, 02:22:41 PM »
Ok. I have a HTML form with four buttons. B1=100, B2=250, B3=500, B4=Custom

When the press B4 a input pops up asking them to ender a number.

Finally on the bottom of the page I have a line "Amount to charge: $0.00". When they enter B1, B2, B3 the $0.00 updates automatically to the relative amount.

Now for the custom entered amount, how can I change the last line to reflect the amount entered automatically.

The file is also using javascript

Offline AnonymousUser

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: Feb 2013
  • Posts: 3002
  • Total likes: 13
  • DansDeals.com Hat Tips 0
    • View Profile
Re: Programming for Beginners
« Reply #326 on: November 20, 2015, 03:18:15 PM »


Ok. I have a HTML form with four buttons. B1=100, B2=250, B3=500, B4=Custom

When the press B4 a input pops up asking them to ender a number.

Finally on the bottom of the page I have a line "Amount to charge: $0.00". When they enter B1, B2, B3 the $0.00 updates automatically to the relative amount.

Now for the custom entered amount, how can I change the last line to reflect the amount entered automatically.

The file is also using javascript

After you store the value from the input into a variable, use the same method as the other buttons to put that value where you want it to go.
For pure JS it would be something like this, assuming the amount was in its own div:
document.getElementById("Amount").innerHTML = amount;

Offline smurf

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: Sep 2010
  • Posts: 4554
  • Total likes: 300
  • DansDeals.com Hat Tips 8
    • View Profile
  • Location: NJ
Re: Programming for Beginners
« Reply #327 on: November 20, 2015, 04:20:51 PM »

After you store the value from the input into a variable, use the same method as the other buttons to put that value where you want it to go.
For pure JS it would be something like this, assuming the amount was in its own div:
document.getElementById("Amount").innerHTML = amount;
I'm assuming this data is being posted to a server.So it's probably an input type field in which case you'd replace "innerHTML" with "value"

Offline 1050BU

  • Dansdeals Gold Elite
  • ***
  • Join Date: Sep 2015
  • Posts: 154
  • Total likes: 1
  • DansDeals.com Hat Tips 1
    • View Profile
Re: Programming for Beginners
« Reply #328 on: November 20, 2015, 04:28:55 PM »
Will try that. Thnx

Offline yesitsme

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Dec 2014
  • Posts: 5116
  • Total likes: 2238
  • DansDeals.com Hat Tips 4
  • Gender: Male
    • View Profile
Re: Programming for Beginners
« Reply #329 on: November 22, 2015, 10:56:22 AM »
Code: [Select]
<!DOCUMENT html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<label for="cu">
<input type="text" id="cu" onkeyup="val()"></label>
<label for="re">
<input type="text" id="re"></label>
<div id="d"></div>

<script>
function $(id){
return document.getElementById(id);
}

function val(){
var a = $("cu").value;
console.log(a);
$("d").innerHTML = a;
$("re").value = a;
}

</script>
</body>
</html>
« Last Edit: November 22, 2015, 11:02:50 AM by yesitsme »
["-"]

Online etech0

  • Dansdeals Lifetime 10K Presidential Platinum Elite
  • *******
  • Join Date: Dec 2013
  • Posts: 12917
  • Total likes: 3370
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
Re: Programming for Beginners
« Reply #330 on: December 02, 2015, 08:48:49 PM »
Workflowy. You won't know what you're missing until you try it.

Online etech0

  • Dansdeals Lifetime 10K Presidential Platinum Elite
  • *******
  • Join Date: Dec 2013
  • Posts: 12917
  • Total likes: 3370
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
Workflowy. You won't know what you're missing until you try it.

Offline chucksterace

  • Dansdeals Lifetime Presidential Platinum Elite
  • *********
  • Join Date: Jul 2012
  • Posts: 6890
  • Total likes: 19
  • DansDeals.com Hat Tips 40
  • Gender: Male
    • View Profile
    • LYNX IT Consulting
  • Location: Chicago, Jerusalem
  • Programs: AA Exec Plat; UA Premier 1K; ; LY Plat; Hyatt Platinum; Hertz President's Circle; Avis President's Club
Re: Programming for Beginners
« Reply #332 on: December 27, 2015, 02:50:04 PM »
I have a few Javascript variables I need emailed to a person after they only input their email and push submit.

Any simple way to do this?
You may not hold me responsible for any actions taken that were recommended from my account or username.

Offline JoeyShmoe

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Nov 2014
  • Posts: 1286
  • Total likes: 254
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
Re: Programming for Beginners
« Reply #333 on: December 27, 2015, 03:33:17 PM »
I have a few Javascript variables I need emailed to a person after they only input their email and push submit.

Any simple way to do this?
You need a server for that, Javascript can't send emails. You can send the Javascript variables to your server and email it from there
DDF A-Z Link Extension
Chrome
Firefox
Info

Offline AnonymousUser

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: Feb 2013
  • Posts: 3002
  • Total likes: 13
  • DansDeals.com Hat Tips 0
    • View Profile
Re: Programming for Beginners
« Reply #334 on: December 28, 2015, 12:17:32 PM »
I have a few Javascript variables I need emailed to a person after they only input their email and push submit.

Any simple way to do this?
Use Google App Scripts.

Online etech0

  • Dansdeals Lifetime 10K Presidential Platinum Elite
  • *******
  • Join Date: Dec 2013
  • Posts: 12917
  • Total likes: 3370
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
Workflowy. You won't know what you're missing until you try it.

Online etech0

  • Dansdeals Lifetime 10K Presidential Platinum Elite
  • *******
  • Join Date: Dec 2013
  • Posts: 12917
  • Total likes: 3370
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: not lakewood
  • Programs: DDF
Re: Programming for Beginners
« Reply #336 on: January 17, 2016, 03:09:00 PM »
Workflowy. You won't know what you're missing until you try it.

Offline yakov116

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: May 2014
  • Posts: 1562
  • Total likes: 205
  • DansDeals.com Hat Tips 1
  • Gender: Male
    • View Profile
Re: Programming for Beginners
« Reply #337 on: March 07, 2016, 12:09:22 PM »
Can anyone help me figure out why it's grabbing the "To" name not the "To" email address"?

Code: [Select]
Public Sub Check_ReceivedTime(newMail As Outlook.MailItem)

Dim obj As Object
Dim ReceivedHour As Integer
Dim newReply As MailItem
Dim msg As String

 
ReceivedHour = Hour(newMail.ReceivedTime)

'Only do anything if before Shabbos
If weekday(newMail.ReceivedTime) < 6 Then
If weekday(newMail.ReceivedTime) = 5 Then
    msg = "Sorry I am not in the office, I will respond on Sunday morning. If its urgent please email **********"
Else
    If ReceivedHour <= 2 Or ReceivedHour >= 19 Then
    msg = "Sorry I have have left the office alrady, I will respond tomorrow morning after 10:30 am."
    ElseIf ReceivedHour >= 3 And ReceivedHour <= 1030 Then
    msg = "Sorry I am not in the office, I will respond after 10:30 am or on Sunday after 11:am."

Else

    Debug.Print "After 10:30, not Friday. Do not sent the automated reply."

End If
End If
End If
'End If

If Len(msg) > 0 Then
    Set newReply = newMail.Reply
    CreateMail newReply.To, msg
End If

Set newReply = Nothing

End Sub

 
Private Sub CreateMail(ReplyAddress As String, msg As String)

Dim objMail As Outlook.MailItem

Set objMail = CreateItem(olMailItem)

With objMail
    .To = ReplyAddress
    .Body = msg
    .Subject = "Please Note!"

    .Display
    ' or
    ' .Send

End With

End Sub
Dont worry about the timing that i have fixed but the rest....
I need this done by yesterday so if any one can help me

I tried using

Code: [Select]
If Len(msg) > 0 Then
    Set newReply = newMail.Reply
    CreateMail newReply.Recipients(0), msg
    MsgBox newReply.Recipients.Count & " " & newReply.Recipients(0)
End If
 
Set newReply = Nothing
 
End Sub
 
 
Private Sub CreateMail(ReplyAddress As String, msg As String)
 
Dim objMail As Outlook.MailItem
 
Set objMail = CreateItem(olMailItem)
 
With objMail
    .Recipients.Add (ReplyAddress)
    .Body = msg
    .Subject = "Please Note!"
 
    .Display
    ' or
    ' .Send
 
End With
 
End Sub

But that did nothing.

Thanks
Money talks...mine says goodbye!

Offline yakov116

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: May 2014
  • Posts: 1562
  • Total likes: 205
  • DansDeals.com Hat Tips 1
  • Gender: Male
    • View Profile
Re: Programming for Beginners
« Reply #338 on: March 07, 2016, 04:28:55 PM »
Can anyone help me figure out why it's grabbing the "To" name not the "To" email address"?

Code: [Select]
Public Sub Check_ReceivedTime(newMail As Outlook.MailItem)

Dim obj As Object
Dim ReceivedHour As Integer
Dim newReply As MailItem
Dim msg As String

 
ReceivedHour = Hour(newMail.ReceivedTime)

'Only do anything if before Shabbos
If weekday(newMail.ReceivedTime) < 6 Then
If weekday(newMail.ReceivedTime) = 5 Then
    msg = "Sorry I am not in the office, I will respond on Sunday morning. If its urgent please email **********"
Else
    If ReceivedHour <= 2 Or ReceivedHour >= 19 Then
    msg = "Sorry I have have left the office alrady, I will respond tomorrow morning after 10:30 am."
    ElseIf ReceivedHour >= 3 And ReceivedHour <= 1030 Then
    msg = "Sorry I am not in the office, I will respond after 10:30 am or on Sunday after 11:am."

Else

    Debug.Print "After 10:30, not Friday. Do not sent the automated reply."

End If
End If
End If
'End If

If Len(msg) > 0 Then
    Set newReply = newMail.Reply
    CreateMail newReply.To, msg
End If

Set newReply = Nothing

End Sub

 
Private Sub CreateMail(ReplyAddress As String, msg As String)

Dim objMail As Outlook.MailItem

Set objMail = CreateItem(olMailItem)

With objMail
    .To = ReplyAddress
    .Body = msg
    .Subject = "Please Note!"

    .Display
    ' or
    ' .Send

End With

End Sub
Dont worry about the timing that i have fixed but the rest....
I need this done by yesterday so if any one can help me

I tried using

Code: [Select]
If Len(msg) > 0 Then
    Set newReply = newMail.Reply
    CreateMail newReply.Recipients(0), msg
    MsgBox newReply.Recipients.Count & " " & newReply.Recipients(0)
End If
 
Set newReply = Nothing
 
End Sub
 
 
Private Sub CreateMail(ReplyAddress As String, msg As String)
 
Dim objMail As Outlook.MailItem
 
Set objMail = CreateItem(olMailItem)
 
With objMail
    .Recipients.Add (ReplyAddress)
    .Body = msg
    .Subject = "Please Note!"
 
    .Display
    ' or
    ' .Send
 
End With
 
End Sub

But that did nothing.

Thanks
Bump
Money talks...mine says goodbye!

Offline JoeyShmoe

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Nov 2014
  • Posts: 1286
  • Total likes: 254
  • DansDeals.com Hat Tips 0
  • Gender: Male
    • View Profile
  • Location: Lakewood
Re: Programming for Beginners
« Reply #339 on: March 07, 2016, 04:54:56 PM »
Bump
Based on MSDN here .To (which you pass into Create Mail newReply.To) it returns the names, not the address
Quote from: https://msdn.microsoft.com/en-us/library/office/ff860378.aspx
Returns or sets a semicolon-delimited String list of display names for the To recipients for the Outlook item. Read/write.

Here's a list of the parameters for the MailItem Object.

P.S. I've never actually seen this code before, this is a product of my research
DDF A-Z Link Extension
Chrome
Firefox
Info