Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Javascript / Client Side Development

Pass value from a ahref to a textbox


http://www.zshare.net/image/problem-png.html

I want to make the text on the left 2 columns clickable. When it's
clicked, the form will be POSTed and the code in the leftmost column
will be submitted as $_REQUEST['item_selected'].

How could I do that?

--
   .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
  / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.21.1
   ^ ^   18:59:01 up 17 days 3:52 1 user load average: 0.03 0.03 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

On May 15, 11:59 am, Man-wai Chang <toylet.toy@gmail.com> wrote:

> http://www.zshare.net/image/problem-png.html

> I want to make the text on the left 2 columns clickable. When it's
> clicked, the form will be POSTed and the code in the leftmost column
> will be submitted as $_REQUEST['item_selected'].

> How could I do that?

> --
>    .~.   Might, Courage, Vision, SINCERITY.http://www.linux-sxs.org
>   / v \  Simplicity is Beauty! May the Force and Farce be with you!
> /( _ )\ (Ubuntu 6.10)  Linux 2.6.21.1
>    ^ ^   18:59:01 up 17 days 3:52 1 user load average: 0.03 0.03 0.00
> news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

<script>
function submitnow(itemvalue)
{
document.getElementById('item_selected').value = itemvalue;
document.getElementById('myform').submit();
//will work if the form id is "myform"
}

</script>

<form id="myform" ....>
have a hidden input called
<input type="hidden" name="item_selected" />

make the text links and use
onclick="submitnow('B0001')"

you can access the posted value at $_POST['item_selected'] or
$_REQUEST['item_selected']

> <script>
> function submitnow(itemvalue)
> {
> document.getElementById('item_selected').value = itemvalue;
> document.getElementById('myform').submit();
> //will work if the form id is "myform"
> }
> </script>

Thank you very much

--
iTech Consulting Services Limited
Expert in ePOS (Point-Of-Sales) solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883     Fax: (852)2325 8288

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc