This topic is locked

Popup with input field

8/7/2010 11:23:39 AM
PHPRunner General questions
C
christoph30 author

Hello,
I added a new button on a list page in php runner.
In the coding on the visual tab I entered the following code for the button:
<INPUT class=button value="TEST" onclick="date=prompt('Please enter date.',''); document.forms.frmAdmin.date.value=date; frmAdmin.submit();" >
on the "before delete event" on the list page I added the following:
if(@$_POST["a"]=="date")

{

$strSQL = "UPDATE customer SET date = '".$_POST["date"]."' where ". $where;

db_exec($strSQL,$conn);

}
Unfortunatly the popup appears, I can enter the a value and I can click ok, but nothing happened afterwards.

Means the update is not done.
Is there something missing?
Thanks in advance for help.
Chris.

A
ann 8/9/2010

Chris,
here is the correct syntax for 'Test' button:

<INPUT class=button onclick="date=prompt('Please enter date.',''); var form = $('#frmAdmin1')[0]; form.a.value=date; form.submit(); return false;" value=TEST>



Also you need to modify the code in the event:

if(@$_POST["a"]=="delete")

return true;

else {

$strSQL = "UPDATE `customer` SET date = '".$_POST["a"]."' where ". $where;

CustomQuery($strSQL);

}

return false;
C
christoph30 author 8/12/2010



Chris,
here is the correct syntax for 'Test' button:

<INPUT class=button onclick="date=prompt('Please enter date.',''); var form = $('#frmAdmin1')[0]; form.a.value=date; form.submit(); return false;" value=TEST>



Also you need to modify the code in the event:

if(@$_POST["a"]=="delete")

return true;

else {

$strSQL = "UPDATE `customer` SET date = '".$_POST["a"]."' where ". $where;

CustomQuery($strSQL);

}

return false;



Hi Ann,
thanks for the coding.

Unfortunately this is not working. The popup appear, but nothing happen than.

I guess this is because of other buttons:
if(@$_POST["a"]=="block")

{

$strSQL = "UPDATE customer SET blocked = 'X' where ". $where;

db_exec($strSQL,$conn);

}
The coding of the working button, but without a possibility to enter a value:

<INPUT class=button onclick="if (!confirm('Would you like to block?')) return false; frmAdmin.a.value='block'; frmAdmin.submit(); return false;" value="Set Block indicator" type=button name=acceptsel disptype="control1">
This button "block" button is working.
Do you have an idea what I should change in the "before list" entry maybe?
Thanks.
Chris

A
ann 8/13/2010

Chris,
is it working if you comment the code you have already in the event?

C
christoph30 author 8/13/2010

Ann,
I comment my other coding in the before list event und put 1 to 1 your coding inside there, but only the popup appear, but no update of the database will be done. Means: nothing happen.

Something on the button code is maybe not ok, but I have right now no idea?

Do you?
Chris.

C
christoph30 author 8/13/2010

Ann,
one additional remark.

The other button without a input popup still working. But they are writing the word: block in the field for the date now.

So I am pretty sure, someting on the button coding with the popup ist not ok.
Chris.

A
ann 8/16/2010

Chris,
It's difficult to tell you what's happening without seeing actual files.

Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error. 'Demo Account' button can be found on the last screen in the program.

C
christoph30 author 8/16/2010

Ann,
it is working now.

The issue was, that I have to set $('#frmAdmin') instead of $('#frmAdmin1')

Means: without the 1 at the end.

I guess this is because of Version 5.1?
Regards,

Chris

A
ann 8/17/2010

Chris,
yes, names of controls were changed in PHPRunner 5.2.