Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #9478

Re: How to make a multiline alert?

From Jake Jarvis <pig_in_shoes@yahoo.com>
Newsgroups comp.lang.javascript
Subject Re: How to make a multiline alert?
Date 2011-12-21 00:44 +0100
Message-ID <9lckvcF16aU1@mid.uni-berlin.de> (permalink)
References <c23c39d1-60f1-4155-a08f-df89e4cd36e8@g41g2000yqa.googlegroups.com>

Show all headers | View raw


On 21.12.2011 00:09, Ted Byers wrote:
> Here is the beginning of the function:
>    print "function validateFormData(vtf2) {
>             var x = vtf2.ccn.value
>             var msg = \"\";
>             var newline = \'CR\';
>             if (x==null || x==\"\") {
>               vtf2.ccn.bgColor=\"lightred\";
>               msg.concat(\"\\r\\n\",\"Credit card number must be
> provided\");
>             }
>             if (!isNumber(x)) {
>               msg.concat(\"\\r\\n\",\"Credit card number must be a
> number\");
>             }
>             x = vtf2.ccexp.value
>             if (x==null || x==\"\") {
>               msg.concat(\"\\r\\n\",\"Credit card expiry date must be
> provided\");
>               alert(msg);
>               return false;
>             }
>
> I managed to get this function to be executed, but it only displays
> the first "Credit card number must be provided", but not the second

Please post just the (complete) output source code.

> "Credit card expiry date must be provided'.  The concatenation looks
> like it is working, at least the first time.  But what can be the

That is impossible for the (incomplete) piece of code you posted, the 
'concat' method returns a new string and you never assign again to 'msg'.

> problem.  Is there a limit t the number of times concat can be called
> on a string, or is alert limited in terms of the number of lines of
> text it can display?
>
> Any insights that can be provided would be appreciated.
>

-- 
Jake Jarvis

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

How to make a multiline alert? Ted Byers <r.ted.byers@gmail.com> - 2011-12-20 15:09 -0800
  Re: How to make a multiline alert? "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2011-12-21 01:42 +0200
  Re: How to make a multiline alert? Gene Wirchenko <genew@ocis.net> - 2011-12-20 15:43 -0800
  Re: How to make a multiline alert? Jake Jarvis <pig_in_shoes@yahoo.com> - 2011-12-21 00:44 +0100

csiph-web