Hello to everyone,
I'm very new about PHP and JavaScript.
I need your help about a simple question, simple for you not for me.
The target is in the same table I have to copy a field in another one using a button.
I wrote this :
$j(function() {
$j(
'<div class="btn-group-vertical btn-group-lg vspacer-lg" style="width: 100%;">' +
'<button type="button" class="btn btn-primary btn-lg">' +
'<i class="glyphicon glyphicon-list-alt"></i> Check Heart Rate' +
'</button>' +
'</div>'
).appendTo('.detail_view .btn-toolbar');
$j("reqhr").clone().appendTo("command");
If I wrote rightly, now I need a string to execute the last string when I click the button
Could you please help me?
Thank you so much
I need a little help
Re: I need a little help
Hi,
as I cannot say if the statement $j("reqhr").clone().appendTo("command"); will work, ( I would guess it does not as your selectors seem odd)
and I do not have the information about your fields (and fieldtype) I can only provide parital information.
You could try something like the below for your button. Keep in mind, that every time the user will click the butten the copy function will be called.
as I cannot say if the statement $j("reqhr").clone().appendTo("command"); will work, ( I would guess it does not as your selectors seem odd)
and I do not have the information about your fields (and fieldtype) I can only provide parital information.
You could try something like the below for your button. Keep in mind, that every time the user will click the butten the copy function will be called.
Code: Select all
function copy() {
<!-- put here the code you need to copy your data -->
}
$j(function() {
$j(
'<div class="btn-group-vertical btn-group-lg vspacer-lg" style="width: 100%;">' +
'<button id="bc" onclick="copy()" type="button" class="btn btn-primary btn-lg">' +
'<i class="glyphicon glyphicon-list-alt"></i> Check Heart Rate' +
'</button>' +
'</div>'
).appendTo('.detail_view .btn-toolbar');
});
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: I need a little help
Thank you so much for your help.
I really appreciate.
I will test now
Thank you
I really appreciate.
I will test now
Thank you
Re: I need a little help
I beg your pardon disturbing you now.
Just to explain better the situation, I need to copy the string inside the reqhr to the string called command.
How can I do this?
Thank you so much for your big patience, availability and kindness
Best regards
Davide
Best regards
Just to explain better the situation, I need to copy the string inside the reqhr to the string called command.
How can I do this?
Thank you so much for your big patience, availability and kindness
Best regards
Davide
Best regards
Re: I need a little help
Hi,
what fields are reqhr and command? input fields? maybe you can post a screenshot.
at a first shot you may try $j('#command').val($j('#reqhr').val()) to copy.
what fields are reqhr and command? input fields? maybe you can post a screenshot.
at a first shot you may try $j('#command').val($j('#reqhr').val()) to copy.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: I need a little help
Thank you for your answer.
I put here the screenshoot of both.
Basically reqhr is an autofill field. It is automatically made when I put values in other fields.
command in a text filed where I have to copy reqhr
Thank you so much for your help
Davide
I put here the screenshoot of both.
Basically reqhr is an autofill field. It is automatically made when I put values in other fields.
command in a text filed where I have to copy reqhr
Thank you so much for your help
Davide
- Attachments
-
- reqhr.PNG (1.85 KiB) Viewed 2670 times
-
- command.PNG (915 Bytes) Viewed 2670 times
Re: I need a little help
ok, thanks, so in that case you can try
$j('#command').val($j('#reqhr').text().trim());
$j('#command').val($j('#reqhr').text().trim());
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: I need a little help
Dear pböttcher, you are my hero.
Thank you so much
It is working
Thank you
Thank you so much
It is working
Thank you
Re: I need a little help
Good morning
I apologise disturbing you today.
I need a help yet about this.
The target is the same, to copy a string inside a mysql field.
Using your advice I sorted out the problem but I faced other new:
Could you helo me to add the right filter to select the right wid please?
Thank you so much
Davide
<?php
$code=",073#";
$code1="IXL,";
$row= ["wid"];
$servername = "localhost";
$database = "c1ms";
$username = "c1us";
$password = "test";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);
$sql = "SELECT wid FROM patients";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo $codeheart."".$row["wid"]."".$code. "<br>";
}
}
?>
I apologise disturbing you today.
I need a help yet about this.
The target is the same, to copy a string inside a mysql field.
Using your advice I sorted out the problem but I faced other new:
- I can hide the fields on the webpage because if they are not visible, rightly , the function doesn't works and I can't leave the visible.
- .js file to make the button and to call the .php file
- .php file to make the string using the db data
Could you helo me to add the right filter to select the right wid please?
Thank you so much
Davide
<?php
$code=",073#";
$code1="IXL,";
$row= ["wid"];
$servername = "localhost";
$database = "c1ms";
$username = "c1us";
$password = "test";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);
$sql = "SELECT wid FROM patients";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo $codeheart."".$row["wid"]."".$code. "<br>";
}
}
?>