TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   How do i get to the last line (http://www.talkphp.com/general/4539-how-do-i-get-last-line.html)

sandhyagupta 06-12-2009 06:19 AM

How do i get to the last line
 
Hi tony, wild honey
i tried to code for the populating thing which i asked u before.
here s my code:
HTML Code:

<html>
  <head>
    <script type="text/javascript">
      function ValidateForm()
      {
        var data = document.frmSample.textarea1.value
        // Code for email validation
        var mysplitresult = data.split("\n");
        document.frmSample.contactname.value = mysplitresult[0]
        m = data.match(/\w+[.]?\w+[.]?\w*@\w+[.]\w+[.]?\w+/g);
        document.frmSample.email.value = m
        // code for website
        //n = data.match(/^((http|www):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+\.[^#?\s]+)(#[\w\-]+)?$/);
        //document.frmSample.web.value = n
        // Code for spliting the phone nos
        var n = mysplitresult[1]
        var mysplitresult1 = n.split("-");
        var length1 = mysplitresult1[2].length
        //document.write(length1);
        if(length1==10)
        {
          document.frmSample.mobile.value = mysplitresult1[2]
        }
        else
        {
          document.frmSample.phone.value = mysplitresult1[2]
        }

      }
    </script>
  </head>
  <body>
    <form action=" " method="POST" name="frmSample" onsubmit="return ValidateForm()">
      <table>
        <TR>
          <TD rowspan=10>
              TextArea<textarea name = 'textarea1' rows='28' cols='80'>
              </textarea>
          </TD>
          <TD>
              <input type=button value="click" onclick="ValidateForm()">
          </TD>
        </TR>
        <TR>
          <TD>
              Contact:<input type=text name="contactname" size=25>
          </TD>
        </TR>
        <TR>
          <TD>
              Email id:<input type=text name="email" size=25>
          </TD>
        </TR>
        <TR>
          <TD>
              Mobile no:<input type=text name="mobile" size=20>
          </TD>
        </TR>
        <TR>
          <TD>
              phone no:<input type=text name="phone" size=20>
          </TD>
        </TR>
      </table>
    </form>
  </body>
</html>

i dono wtz wrng in the match function for website.. itz nt displaying it.
n hoe do i get to the last line in the text n display the address.

few egs of wt i will be pasting in the text field are:
Code:

        Mr Rama Moorthy   
        +(91)-(80)-66491588
        info@novatechnosys.co.in
        ramamoorthym@novatechnosys.co.in
        No.729,1st Flr, Hal 2nd Stg, 8th Crs,11th Mn, Indiranagar, Bangalore - 560038



     
        Mr Srinivas(Managing Director)   
        +(91)-(80)-66492233
        srinivas@vyasam.com
        chetan@vyasam.com
        No. 1 & 2, 3rd Flr, Nr Sharavathi Hospital, Service Rd, Vijaynagar, Bangalore - 560040


          Mr Ananda Reddy K   
        +(91)-(80)-66366685
        ananda@srivatech.com
        www.srivatech.com
        No.430,, 5th Main, Shastri Nagar, Bangalore - 560028


Hightower 06-12-2009 08:22 AM

OMG! FFS! Hoe bout u tri usin sum code tagz n stop typin lyk dis on a forum!

sandhyagupta 06-12-2009 09:26 AM

stop typing like this on a forum means wt? so plz tell me hw m i supposed to type?

Hightower 06-12-2009 10:05 AM

ERROR!

ID: 10t

sketchMedia 06-12-2009 10:08 AM

I have a feeling he means, wrap the code in the related bbcode tags.

Schroder 06-12-2009 01:15 PM

If it's always going to be the very last line of your pasted text you can put this line inside your function:

Code:

mysplitresult[mysplitresult.length-1]
Hope that helps.

Salathe 06-12-2009 01:21 PM

Note: I've edited the first post to wrap code/examples in prettiness.

Hightower 06-12-2009 02:25 PM

Can you not edit the SMS language as well?! :-(

Village Idiot 06-12-2009 03:17 PM

I apologize for the rudeness of people here. We have a BBcode that you can wrap code in, that tag is [code] and [/code].

Also, this belongs in the general coding section, so I'm moving it there.

sandhyagupta 06-13-2009 05:09 AM

@ Schroder Thanks a lot. will try using it in the code. it may help me out.

sandhyagupta 06-13-2009 05:11 AM

@ Salathe thanks a lot for your help. i dint know about this. from next time i shall make sure to wrap the code and post. Sorry for the trouble

sandhyagupta 06-13-2009 05:19 AM

@ Village Idiot Yeah as i said thanks a lot to you also. i was not aware of this. sorry for causing all u people trouble. thank u once again.

Hightower 06-13-2009 02:54 PM

Hi everyone, sorry for being so sharp yesterday - wasn't having the best of days. Still, that's no reason for the comments I made.

Sorry sandhyagupta :-(

All I meant was to wrap your code to make it easier to read.

Wildhoney 06-13-2009 02:58 PM

That's okay, Hightower :-) I thought you were a bit cruel, too, but nonetheless, the apology is more than appreciated! Happy days.

Has this issue of extracting the last line been resolved, by the way?

hjalmar 06-14-2009 01:12 AM

Quote:

Originally Posted by Hightower (Post 25352)
Hi everyone, sorry for being so sharp yesterday - wasn't having the best of days. Still, that's no reason for the comments I made.

Sorry sandhyagupta :-(

All I meant was to wrap your code to make it easier to read.

Now i'm gonna be the fucker that everyone hates.. but damn don't apologize because someone skipped school. I've read the initial post several times and I still can't understand what the hell he/she is saying. (Not everyone has English as their first language, uhm and the sms lingo is way beyond my head.)

Your reply is justified. And I like! :)

Hjalmar

sandhyagupta 06-15-2009 09:52 AM

Quote:

Originally Posted by Hightower (Post 25352)
Hi everyone, sorry for being so sharp yesterday - wasn't having the best of days. Still, that's no reason for the comments I made.

Sorry sandhyagupta :-(

All I meant was to wrap your code to make it easier to read.

Thats ok not a problem.

sandhyagupta 06-15-2009 09:55 AM

Hi wildhoney,

Thaks a lot for the support.Yes my problem has been resolved. My program is working fine :)


All times are GMT. The time now is 08:29 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0