Computing.Net > Forums > Web Development > Can anyone help me plz

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Can anyone help me plz

Reply to Message Icon

Name: sandhyagupta
Date: June 11, 2009 at 23:14:08 Pacific
OS: N/A
Subcategory: Javascript/Ajax
Comment:

Hi everyone,

I am new to javascript. here s my objective,
)i need to create a form with few fields like phoneno,website,address etc and one text area.
2) i copy n paste the details in the textarea n when i click d button. it
should automatically populate things into the respective fields.

eg of info wt i will be pasting in d text field:
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


Here s my 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 my match function for website. its nt displaying it.
the address will always be in the last line. how do i go to the last line n display the address irrespective of no of lines?

plz somebody help me out wit this.thanks in advance.



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Can anyone help me plz

Phishing Script... help me find! www.computing.net/answers/webdevel/phishing-script-help-me-find/3888.html

can anyone help? www.computing.net/answers/webdevel/can-anyone-help/2091.html

php help needed www.computing.net/answers/webdevel/php-help-needed/2399.html