Help with XML in variable please.

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

drolaz
Posts: 17
Joined: Fri Jan 18, 2013 7:10 pm

Re: Help with XML in variable please.

Post by drolaz » Tue May 14, 2013 7:16 pm

Mark,
I feel like a complete *** .
It seems that in the field properties there were two lines of the IP Address. Hence the error.
And now your code works!
To that I send you a digital beer of your choice, and raise my glass to you!

If I can bug you for one more thing... :)

Is there a way to lock my field so it only excepts xxx.xxx.xxx.xxx ??

If I am being a pain I am truly sorry and your help has been a huge help!

Thanks
Al

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Help with XML in variable please.

Post by Mark » Tue May 14, 2013 7:28 pm

Hi Al,

You can set the lockText of the field to true. You can also use the properties inspector for this.

You could also check the contents of the field at the start of your script:

constant dot = "."

Code: Select all

on mouseUp
  put fld "ipaddy" into IpAddress
  if number of items of IpAddressis 4 then
    repeat for each item myItem in IpAddress
      if myItem is not an integer then
        beep
        answer error "Please, enter a correct IP address."
        exit mouseUp
      end if
    end repeat
  else
    beep
    answer error "Please, enter a correct IP address."
    exit mouseUp
  end if
  // remainder of your script here
end mouseUp
Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

drolaz
Posts: 17
Joined: Fri Jan 18, 2013 7:10 pm

Re: Help with XML in variable please.

Post by drolaz » Tue May 14, 2013 8:06 pm

Beautiful!

Thank you Mark for all your time and help it is greatly appreciated.

Al

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Help with XML in variable please.

Post by Mark » Tue May 14, 2013 8:08 pm

You're welcome, Al.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply