This topic is locked
[SOLVED]

 check existence of record before adding

1/25/2011 1:51:49 PM
PHPRunner General questions
C
chingupt author

Hi,
I have the following details which the client is adding:
Student First Name

Student Last Name

Student Birth Date

Student Mobile

Student Email
The DB contains a large number of records. Now to avoid duplicacy, as soon as the client enters First Name,Last Name and DOB, can the system somehow check whether record with this detail already exists in DB? Or can i provide a link "Check Availability" which will check the DB for this record?
How can this be done?
Please help
Regards

Sergey Kornilov admin 1/25/2011

Sure, use BeforeAdd event and sample action 'Check if record exists' for this purpose.

C
chingupt author 2/1/2011

This is not how it is required by the client. We want that when the user enters First Name and Last Name, a Button/Hyperlink should become enabled and on clicking it should show all records matching these fields. This i think can be achieved by redirecting to the search page with these two fields as paramaters.
How can i pass the first name entered in the testbox to the hyperlink?

Sergey Kornilov admin 2/1/2011

You can do so using Javascript API:

http://xlinesoft.com/phprunner/docs/javascript_api.htm
To read the value of text box use getValue() function.

C
chingupt author 2/18/2011

I am bit lost here. I tried a lot but could not get the value of the text box in the url i am trying to populate.

Can you please show me how.
I have uploaded the snap where i am trying to get the link working. From here i am trying to open up a new page which will produce the results page showing all records with the desired name.
<A href="student_personal_info_list.php?a=integrated&amp;simpleSrchFieldsComboOpt=&amp;simpleSrchTypeComboNot=&amp;simpleSrchTypeComboOpt=&amp;criteria=and&amp;type1=&amp;value11=FirstName&amp;field1=First+Name&amp;option1=Contains&amp;not1=">*Availabile?</A>
Somebody please help me out here.
Regards

Sachin

Sergey Kornilov admin 2/18/2011

Sachin,
clarify what exactly is the question.
To access the current value of a text box use Javascript API's getValue() function:

http://xlinesoft.com/phprunner/docs/ctrl_getvalue.htm
Using this value you can build a proper hyperlink.

C
chingupt author 2/18/2011

Sergey,
Using the getvalue(), i got the value.
I added a php snippet for generating the hyperlink:
var ctrl = Runner.getControl(pageid, 'First Name');

var value = ctrl.getValue();
echo "<A href="student_personal_info_list.php?a=integrated&amp;simpleSrchFieldsComboOpt=&amp;simpleSrchTypeComboNot=&amp;simpleSrchTypeComboOpt=&amp;criteria=and&amp;type1=&amp;value11=$value&amp;field1=First+Name&amp;option1=Contains&amp;not1=">*Availabile?</A>;
But on execution, it gives error.

Parse error: syntax error, unexpected T_VAR in C:\wamp\www\CPS_SDMS_V1.1\output\include\student_personal_info_events.php on line 616

Sergey Kornilov admin 2/18/2011

You trying to mix PHP and Javascript code which won't work.
You need to insert a button in Visual Editor and perform all calculations in BeforeClient event. Instead on displaying a link simply redirect user to another page or open a new page in popup.

C
chingupt author 2/19/2011

Hi,
To get the value of the text field, i guess one needs the pageid. But pageid is only available in the onPageLoad event. How do i access it on the Button Functionality or any other Page?
Can you please help me out here and provide me with some code.
Thanks

Sachin

C
chingupt author 2/20/2011

Hi,
Let me rephrase:
Suppose we have a form which requires the client to give the students Name, DOB, address, etc.

Now we want a "check availability" functionality which should work work as below:

  1. Client provides New Students "First Name".
  2. A link (Check Availability) alongside this text field will be present.
  3. Client will click on the click on this link.
  4. On clicking, the value in the text field (First Namee) will be read and will be provided as input to the Advanced Search Page.
  5. Here Client will be get the search result based on "First Name".
    URL to access:

    student_personal_infolist.php?a=integrated&amp;simpleSrchFieldsComboOpt=&amp;simpleSrchTypeComboNot=&amp;simpleSrchTypeComboOpt=&amp;criteria=and&amp;type1=&amp;value11=FirstName_&amp;field1=First+Name&amp;option1=Contains&amp;not1=
    Now the problem here is getting the Text Field Value and Passing it as URL parameter.
    Hope this helps.
    Regards

C
chingupt author 2/28/2011

Guys,
No body ready to help or it cant be done?
Somebody please respond!!!
Sachin

Sergey Kornilov admin 2/28/2011

Sachin,
this task requires a bit of custom coding. If you are not able to tackle this - contact support directly supplying your order number.

C
chingupt author 2/28/2011

Hi,
Support ticket filed along with the Order Number.
Regards