Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > oncklick with ID

Reply
Thread Tools

oncklick with ID

 
 
Jan Novak
Guest
Posts: n/a
 
      06-17-2013
Hello,

a have a (php/html) Form with multiple Buttons und multiple input fields.
The Buttons and Fields are generated like this

(php code)
echo '<input name="USERNAME_'.$id.'" class="Feld" value="'
..$record['USERNAME']. '" autocomplete="off" >';


Now i want, that if i click on a button, that one of the filed is filled
up with some data.

(php code)
echo '<input type="button" name="zeige" class="Button" value="Show"
onclick="this.form.USERNAME_'.$id.'.value=\''.$rec ord['USERNAME'].'\'">
';
This function is only working, if the Textfiled is named without the
"id" extension (like 'Username" and not 'Username_'.$id)

Anybody know a solution for this ?

Jan
 
Reply With Quote
 
 
 
 
TK
Guest
Posts: n/a
 
      06-17-2013
On 6/17/2013 7:02 AM, Jan Novak wrote:
> Hello,
>
> a have a (php/html) Form with multiple Buttons und multiple input fields.
> The Buttons and Fields are generated like this
>
> (php code)
> echo '<input name="USERNAME_'.$id.'" class="Feld" value="'
> .$record['USERNAME']. '" autocomplete="off" >';
>
>
> Now i want, that if i click on a button, that one of the filed is filled
> up with some data.
>
> (php code)
> echo '<input type="button" name="zeige" class="Button" value="Show"
> onclick="this.form.USERNAME_'.$id.'.value=\''.$rec ord['USERNAME'].'\'">
> ';
> This function is only working, if the Textfiled is named without the
> "id" extension (like 'Username" and not 'Username_'.$id)
>
> Anybody know a solution for this ?
>
> Jan

My first thought is that the value of $id is not properly set at the
point you are trying to use it. echo "USERNAME_'.$id.'" - it looks as
if you will get something like username_extension, no .

--
TK ~ aka Terry Kimpling
http://wejuggle2.com/video.php
Soon to be called "Tricks I could do when I was only 65!"
 
Reply With Quote
 
 
 
 
Tim Streater
Guest
Posts: n/a
 
      06-17-2013
In article <kpmts0$5ai$(E-Mail Removed)>,
Jan Novak <(E-Mail Removed)> wrote:

> Hello,
>
> a have a (php/html) Form with multiple Buttons und multiple input fields.
> The Buttons and Fields are generated like this
>
> (php code)
> echo '<input name="USERNAME_'.$id.'" class="Feld" value="'
> .$record['USERNAME']. '" autocomplete="off" >';
>
>
> Now i want, that if i click on a button, that one of the fields is filled
> up with some data.
>
> (php code)
> echo '<input type="button" name="zeige" class="Button" value="Show"
> onclick="this.form.USERNAME_'.$id.'.value=\''.$rec ord['USERNAME'].'\'">
> ';
> This function is only working, if the Textfiled is named without the
> "id" extension (like 'Username" and not 'Username_'.$id)
>
> Anybody know a solution for this ?


You can't do that with PHP; it's not running in the user's browser.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
 
Reply With Quote
 
Ben Bacarisse
Guest
Posts: n/a
 
      06-17-2013
Tim Streater <(E-Mail Removed)> writes:

> In article <kpmts0$5ai$(E-Mail Removed)>,
> Jan Novak <(E-Mail Removed)> wrote:
>>
>> a have a (php/html) Form with multiple Buttons und multiple input fields.
>> The Buttons and Fields are generated like this
>>
>> (php code)
>> echo '<input name="USERNAME_'.$id.'" class="Feld" value="'
>> .$record['USERNAME']. '" autocomplete="off" >';
>>
>>
>> Now i want, that if i click on a button, that one of the fields is
>> filled up with some data.
>>
>> (php code)
>> echo '<input type="button" name="zeige" class="Button" value="Show"
>> onclick="this.form.USERNAME_'.$id.'.value=\''.$rec ord['USERNAME'].'\'">
>> ';
>> This function is only working, if the Textfiled is named without the
>> "id" extension (like 'Username" and not 'Username_'.$id)
>>
>> Anybody know a solution for this ?

>
> You can't do that with PHP; it's not running in the user's browser.


The OP is trying to do it with some client-side scripting generated by
PHP.

To the OP: Posting PHP adds a level of uncertainty about what's actually
going on. What do the two input element look like in the generated
document?

A simple test with these two code fragments used in isolation works for
me, so the problem is somewhere else -- very likely in some other part
of the PHP as has already been suggested.

--
Ben.
 
Reply With Quote
 
Jan Novak
Guest
Posts: n/a
 
      06-17-2013
Am 17.06.2013 16:33, schrieb Ben Bacarisse:

>>> a have a (php/html) Form with multiple Buttons und multiple input fields.
>>> The Buttons and Fields are generated like this
>>>
>>> (php code)
>>> echo '<input name="USERNAME_'.$id.'" class="Feld" value="'
>>> .$record['USERNAME']. '" autocomplete="off" >';
>>>
>>>
>>> Now i want, that if i click on a button, that one of the fields is
>>> filled up with some data.
>>>
>>> (php code)
>>> echo '<input type="button" name="zeige" class="Button" value="Show"
>>> onclick="this.form.USERNAME_'.$id.'.value=\''.$rec ord['USERNAME'].'\'">
>>> ';
>>> This function is only working, if the Textfiled is named without the
>>> "id" extension (like 'Username" and not 'Username_'.$id)


> A simple test with these two code fragments used in isolation works for
> me, so the problem is somewhere else -- very likely in some other part
> of the PHP as has already been suggested.


OK, so i try to search in the resulting HTML Page (source view).
Because it will be always redirect to a ssl site, i must change this,
before i can browse the source.

Jan

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unicode issue with Python v3.3 33 Python 80 04-19-2013 07:16 PM
Help with printing a bit pattern with printf and %x matt.jaffe@gmail.com C Programming 9 04-19-2013 12:14 PM
newbie: Problem with $ and \ in strings vivek_12315 Perl Misc 2 04-12-2013 08:30 PM
Re: print to screen and file with one print statement amiwinter@gmail.com Python 0 04-09-2013 01:31 PM
USBLock : lock/unlock your computer with a USB key Sven Python 0 04-08-2013 03:21 PM



Advertisments