How -to use Client-Side Javascript example?

Can someone please point me to a good example of how to do
this? Sorry, but I'm a PowerBuilder developer and still
don't understand this.
How can you code a javascript file to get data from the
webform, use that data, and set a result back to the
webform?
A small example of coding the itemchanged event would be
great.  In my app, the user's want to be able to enter data
in a field and have that trigger calculations that would
populate other fields.
Can someone give me or point me to a good example of how to
do this?

Thanks
Jay
0
Jay
5/14/2010 4:08:59 PM
sybase.net.webform 1327 articles. 0 followers. Follow

9 Replies
419 Views

Similar Articles

[PageSpeed] 54

Hi, Jay

Read my answer in the thread "Javascript between DW", started by Carlos 
Perez on 7 feb 2010. You'll get an insight how to do this.

Regards,
Ivaylo

<Jay> wrote in message news:4bed759b.50eb.1681692777@sybase.com...
> Can someone please point me to a good example of how to do
> this? Sorry, but I'm a PowerBuilder developer and still
> don't understand this.
> How can you code a javascript file to get data from the
> webform, use that data, and set a result back to the
> webform?
> A small example of coding the itemchanged event would be
> great.  In my app, the user's want to be able to enter data
> in a field and have that trigger calculations that would
> populate other fields.
> Can someone give me or point me to a good example of how to
> do this?
>
> Thanks
> Jay 


0
Ivaylo
5/14/2010 7:16:07 PM
Thanks Ivaylo

Thats another beer I owe you.

Jay

> Hi, Jay
>
> Read my answer in the thread "Javascript between DW",
> started by Carlos  Perez on 7 feb 2010. You'll get an
> insight how to do this.
>
> Regards,
> Ivaylo
>
> <Jay> wrote in message
> > news:4bed759b.50eb.1681692777@sybase.com... Can someone
> > please point me to a good example of how to do this?
> > Sorry, but I'm a PowerBuilder developer and still don't
> > understand this. How can you code a javascript file to
> > get data from the webform, use that data, and set a
> > result back to the webform?
> > A small example of coding the itemchanged event would be
> > great.  In my app, the user's want to be able to enter
> > data in a field and have that trigger calculations that
> > would populate other fields.
> > Can someone give me or point me to a good example of how
> > to do this?
> >
> > Thanks
> > Jay
>
>
0
Jay
5/14/2010 10:05:13 PM
rofl...I'll increment my counter variable ;-))

<Jay> wrote in message news:4bedc919.5a28.1681692777@sybase.com...
> Thanks Ivaylo
>
> Thats another beer I owe you.
>
> Jay
>
>> Hi, Jay
>>
>> Read my answer in the thread "Javascript between DW",
>> started by Carlos  Perez on 7 feb 2010. You'll get an
>> insight how to do this.
>>
>> Regards,
>> Ivaylo
>>
>> <Jay> wrote in message
>> > news:4bed759b.50eb.1681692777@sybase.com... Can someone
>> > please point me to a good example of how to do this?
>> > Sorry, but I'm a PowerBuilder developer and still don't
>> > understand this. How can you code a javascript file to
>> > get data from the webform, use that data, and set a
>> > result back to the webform?
>> > A small example of coding the itemchanged event would be
>> > great.  In my app, the user's want to be able to enter
>> > data in a field and have that trigger calculations that
>> > would populate other fields.
>> > Can someone give me or point me to a good example of how
>> > to do this?
>> >
>> > Thanks
>> > Jay
>>
>> 


0
Ivaylo
5/15/2010 5:42:36 AM
Ivaylo,

I read your thread mentioned below. It is awesome info. Please keep up the 
good work! I'm sure there are many "old PB'rs" out there going through the 
same learning curve as me that find your insight extremely valuable. If they 
ever have another "Real" techwave I to would gladly buy you a brewsky.

Mark

"Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message 
news:4beda177@forums-1-dub...
> Hi, Jay
>
> Read my answer in the thread "Javascript between DW", started by Carlos 
> Perez on 7 feb 2010. You'll get an insight how to do this.
>
> Regards,
> Ivaylo
>
> <Jay> wrote in message news:4bed759b.50eb.1681692777@sybase.com...
>> Can someone please point me to a good example of how to do
>> this? Sorry, but I'm a PowerBuilder developer and still
>> don't understand this.
>> How can you code a javascript file to get data from the
>> webform, use that data, and set a result back to the
>> webform?
>> A small example of coding the itemchanged event would be
>> great.  In my app, the user's want to be able to enter data
>> in a field and have that trigger calculations that would
>> populate other fields.
>> Can someone give me or point me to a good example of how to
>> do this?
>>
>> Thanks
>> Jay
>
> 


0
Mark
5/17/2010 12:20:40 PM
Hey, Mark, thank you for these kind words!!!

It's really hard for me to find spare time for forum/blogging activities 
beside my work. However, what makes me happy most is that supposedly I've 
done my personal goal here - to "touch" some poor programmer's soul, to make 
you experimenting and enjoying your daily achievements, even the little 
ones....and the language (PB/VB/...) doesn't matter at all. ;-)

Best wishes,
Ivaylo

"Mark" <mlibner@yahoo.com> wrote in message news:4bf13498@forums-1-dub...
> Ivaylo,
>
> I read your thread mentioned below. It is awesome info. Please keep up the 
> good work! I'm sure there are many "old PB'rs" out there going through the 
> same learning curve as me that find your insight extremely valuable. If 
> they ever have another "Real" techwave I to would gladly buy you a 
> brewsky.
>
> Mark
>
> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message 
> news:4beda177@forums-1-dub...
>> Hi, Jay
>>
>> Read my answer in the thread "Javascript between DW", started by Carlos 
>> Perez on 7 feb 2010. You'll get an insight how to do this.
>>
>> Regards,
>> Ivaylo
>>
>> <Jay> wrote in message news:4bed759b.50eb.1681692777@sybase.com...
>>> Can someone please point me to a good example of how to do
>>> this? Sorry, but I'm a PowerBuilder developer and still
>>> don't understand this.
>>> How can you code a javascript file to get data from the
>>> webform, use that data, and set a result back to the
>>> webform?
>>> A small example of coding the itemchanged event would be
>>> great.  In my app, the user's want to be able to enter data
>>> in a field and have that trigger calculations that would
>>> populate other fields.
>>> Can someone give me or point me to a good example of how to
>>> do this?
>>>
>>> Thanks
>>> Jay
>>
>>
>
> 


0
Ivaylo
5/17/2010 12:40:29 PM
.... and regarding the way of referring another DW control client-side - 
probably it would be a good idea to encapsulate this logic as a common (base 
for your application) JS functionin accepting DW control's name as an 
argument and returning reference to the proper "sender" instance. This way 
you'd have a single call wherever in a client-side event handler it's 
necessary to get access to the other control.

"Mark" <mlibner@yahoo.com> wrote in message news:4bf13498@forums-1-dub...
> Ivaylo,
>
> I read your thread mentioned below. It is awesome info. Please keep up the 
> good work! I'm sure there are many "old PB'rs" out there going through the 
> same learning curve as me that find your insight extremely valuable. If 
> they ever have another "Real" techwave I to would gladly buy you a 
> brewsky.
>
> Mark
>
> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message 
> news:4beda177@forums-1-dub...
>> Hi, Jay
>>
>> Read my answer in the thread "Javascript between DW", started by Carlos 
>> Perez on 7 feb 2010. You'll get an insight how to do this.
>>
>> Regards,
>> Ivaylo
>>
>> <Jay> wrote in message news:4bed759b.50eb.1681692777@sybase.com...
>>> Can someone please point me to a good example of how to do
>>> this? Sorry, but I'm a PowerBuilder developer and still
>>> don't understand this.
>>> How can you code a javascript file to get data from the
>>> webform, use that data, and set a result back to the
>>> webform?
>>> A small example of coding the itemchanged event would be
>>> great.  In my app, the user's want to be able to enter data
>>> in a field and have that trigger calculations that would
>>> populate other fields.
>>> Can someone give me or point me to a good example of how to
>>> do this?
>>>
>>> Thanks
>>> Jay
>>
>>
>
> 


0
Ivaylo
5/17/2010 12:45:07 PM
That makes sense. I'm just not there yet. I'm still in the "doing lots of 
reading" mode. Unfortunately there isn't a lot of activity on this 
newsgroup.

Mark


"Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message 
news:4bf13a53$1@forums-1-dub...
> ... and regarding the way of referring another DW control client-side - 
> probably it would be a good idea to encapsulate this logic as a common 
> (base for your application) JS functionin accepting DW control's name as 
> an argument and returning reference to the proper "sender" instance. This 
> way you'd have a single call wherever in a client-side event handler it's 
> necessary to get access to the other control.
>
> "Mark" <mlibner@yahoo.com> wrote in message news:4bf13498@forums-1-dub...
>> Ivaylo,
>>
>> I read your thread mentioned below. It is awesome info. Please keep up 
>> the good work! I'm sure there are many "old PB'rs" out there going 
>> through the same learning curve as me that find your insight extremely 
>> valuable. If they ever have another "Real" techwave I to would gladly buy 
>> you a brewsky.
>>
>> Mark
>>
>> "Ivaylo Ivanov" <n0_S_p_a_m_i.ivanov@isy-dc.com> wrote in message 
>> news:4beda177@forums-1-dub...
>>> Hi, Jay
>>>
>>> Read my answer in the thread "Javascript between DW", started by Carlos 
>>> Perez on 7 feb 2010. You'll get an insight how to do this.
>>>
>>> Regards,
>>> Ivaylo
>>>
>>> <Jay> wrote in message news:4bed759b.50eb.1681692777@sybase.com...
>>>> Can someone please point me to a good example of how to do
>>>> this? Sorry, but I'm a PowerBuilder developer and still
>>>> don't understand this.
>>>> How can you code a javascript file to get data from the
>>>> webform, use that data, and set a result back to the
>>>> webform?
>>>> A small example of coding the itemchanged event would be
>>>> great.  In my app, the user's want to be able to enter data
>>>> in a field and have that trigger calculations that would
>>>> populate other fields.
>>>> Can someone give me or point me to a good example of how to
>>>> do this?
>>>>
>>>> Thanks
>>>> Jay
>>>
>>>
>>
>>
>
> 


0
Mark
5/17/2010 12:59:10 PM
I'm sooooo close.  I just can't seem to get a caclulation
returned.
I'm trying to convert a patients weight from kg to pounds.
Here's what I have.

function PatientWeight_ItemChanged(sender, rowNumber,
columnName,newValue)
{	
   if (columnName == "weightkg")
   {
      if (newValue = "")
      {
         sender.SetItem(rowNumber, "weightlb", newValue)
      }
      else
      {
	var n = 0
	n = parseFloat(newValue) * 2.2046
	var outString = n
        sender.SetItem(rowNumber, "weightlb", outString )
      }
   }
   return 0
 }

I've tried converting the return variable to a string using
.ToString() but all I ever get back in NaN.  The example
above actually shows as NaN.00.  When I hard code a number
999 or a string like "999" I get that to show, just can't
get that calculated variable.  What am I doing wrong?

Thanks as always
Jay
0
Jay
5/18/2010 5:07:48 PM
Yes, you're veeeeeryyyy close :))) Just 1 character to go :-))))

if(newValue == "")

The comparison operator is double "=", not a single one!
.... and although it's working I wonder if all these JS statements shouldn't 
be ended with semicolons...

Ohhhh, I'm so thirsty <g>

Regards,
Ivaylo

<Jay> wrote in message news:4bf2c963.1a14.1681692777@sybase.com...
> I'm sooooo close.  I just can't seem to get a caclulation
> returned.
> I'm trying to convert a patients weight from kg to pounds.
> Here's what I have.
>
> function PatientWeight_ItemChanged(sender, rowNumber,
> columnName,newValue)
> {
>   if (columnName == "weightkg")
>   {
>      if (newValue = "")
>      {
>         sender.SetItem(rowNumber, "weightlb", newValue)
>      }
>      else
>      {
> var n = 0
> n = parseFloat(newValue) * 2.2046
> var outString = n
>        sender.SetItem(rowNumber, "weightlb", outString )
>      }
>   }
>   return 0
> }
>
> I've tried converting the return variable to a string using
> ToString() but all I ever get back in NaN.  The example
> above actually shows as NaN.00.  When I hard code a number
> 999 or a string like "999" I get that to show, just can't
> get that calculated variable.  What am I doing wrong?
>
> Thanks as always
> Jay 


0
Ivaylo
5/19/2010 9:25:09 AM
Reply: