Solved

How to fill in an entry using a link

Posted on 2011-09-18
8
687 Views
Last Modified: 2012-05-12
I am creating a link from my school webpage to a service webpage. I would like the link to fill in the "siatrict code" box for everyone that clicks on the link.
0
Comment
Question by:ambantin
8 Comments
 
LVL 6

Expert Comment

by:bartvd
ID: 36556349
You could let the link go to for example mypage.html?ref=myschool where mypage.html is the location of your webpage. You could add javascript to your page to check if ref=myschool is in the link. (it is called a get variable) if it is, you can set a code in the box.
On this page: http://scripts.franciscocharrua.com/javascript-get-variables.php is explained how to read a get variable with javascript, you should check for the variable ref.

However, if this code really only needs to be available for everyone in your school this is not very safe, you should use a server side scripting language like php instead.
0
 
LVL 3

Expert Comment

by:dkellner
ID: 36556455
Basically there is nothing you can do ACROSS two different domains; if that service page doesn't belong to you, browsers will probably deny to do the job.

BUT.

If that form is something simple, you can reimplement it (view source, save, and a little editing) so that you'll have a copy of it that posts exactly the same informations for their server.  Now this is YOUR form, sending informations to THEIR server which is okay by default (unless they have some protection), and with your form, of course, you can do whatever you wish, fill in fields, or even change the whole logic.  All that matters is that you send the same POST-data as the original form.

If you have questions about this, give me some details.
0
 
LVL 3

Expert Comment

by:Duboux
ID: 36556602
what's a siatrict code box ?

U mean u want some form-field to be filled in with a value, when u click on a link ?

<a href="#" onclick="document.getElementById('fieldname').value='bla bla'; return false;">link</a>
<input id="fieldname" />

Open in new window

0
 

Author Comment

by:ambantin
ID: 36557241
sorry... district code box is what i meant. Here is a link to the page that I am linking to.

https://www.renweb.com/Logins/ParentsWeb-Login.aspx

 I want the top "District code" box to be filed in with "CC-SDA"
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 3

Expert Comment

by:Duboux
ID: 36557446
Okay, getting it now, I hope XD

I think you want this:

REPLACE:
<input name="DistrictCode" type="text" id="DistrictCode" class="textEntry" />

Open in new window

WITH:
<input name="DistrictCode" type="text" id="DistrictCode" class="textEntry" value="CC-SDA" />

Open in new window

0
 
LVL 3

Accepted Solution

by:
Duboux earned 500 total points
ID: 36557461
OR... and while I was checking, I accidentally noticed that that page already has the following functionality:

https://www.renweb.com/Logins/ParentsWeb-Login.aspx?district=CC-SDA
Works I guess..

because if you make a typo, it shows it filled in:
https://www.renweb.com/Logins/ParentsWeb-Login.aspx?district=CC-SDAWRONG
0
 

Author Comment

by:ambantin
ID: 36557471
ok... still not clear.... I want to put a link on my school web page that will take the person to

https://www.renweb.com/Logins/ParentsWeb-Login.aspx

and "District code" box on the target page needs to be filed in with "CC-SDA"

the renweb (target) page is not mine and I can't change that page.
0
 

Author Closing Comment

by:ambantin
ID: 36557474
perfect...lol... thanks
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now