Open Source & Stuff  
  |     Main Site     |      Forum     |     Contact     |
Ajax Linked Select boxes :  forum.Salix.gr forum.Salix.gr
Comments, questions, usage, bugs. 
Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
messageHow to change the value in <option value="?" >Please Select</option>
Posted by: Goody (IP Logged)
Date: October 22, 2008 10:11AM

How to change the value in <option value="?" >Please Select</option>


Greetings!

First of all, thank you for this wonderful script.

I had spent almost 2 days looking around for a script to suit my needs and finally I stumbled upon this - easy to implement, highly customisable and more than all it uses MySQL. I am not sure there exists another script that's a good as this - absolutely flawless.

I would like someone to advise me as how to do a small tweaking:

I tried to get ...

<option value="" >Please Select</option> instead of <option value="0" >Please Select</option>

and ...

<option value="" >None</option> instead of <option value="0" >None</option>

... how do i get about doing this? Any help will be much appreciated.


Many thanks

This script is one of its kind!



Edited 1 time(s). Last edit at 10/22/2008 10:13AM by Goody.

messageRe: How to change the value in <option value="?" >Please Select</option>
Posted by: panos (IP Logged)
Date: October 23, 2008 06:46AM

Thank you for your kind word, specialy today i need positive energy.

After a fast look at the code i suggest to:

In function ajax_output_xml_for_none change the line (around line 842)
print '<id>0</id>';
to
print '<id>'.$this->select_prompt_key.'</id>';

then set the $select_prompt_key variable to '' (around line 195) or what ever you need to.

that should do the trick.

Best regards
Panos

messageRe: How to change the value in <option value="?" >Please Select</option>
Posted by: Goody (IP Logged)
Date: October 23, 2008 07:59AM

Thank you for the prompt reply.

It definitely takes the value I put in but instead of displaying "None" it gives a blank box.

Is there a way to fix this?

Kind regards

messageRe: How to change the value in <option value="?" >Please Select</option>
Posted by: panos (IP Logged)
Date: October 23, 2008 01:09PM

hmmmm having an empty <id></id> in the ajax's xml response must do the mischief.
I will investigate this carefully in the morning and try to fix this or find a workaround.

Best Regards
Panos

messageRe: How to change the value in <option value="?" >Please Select</option>
Posted by: Goody (IP Logged)
Date: October 29, 2008 11:42AM

Hi panos,

Sorry to bother you!

Did you have the chance to look into the issue? Basically I would like null value for both "Please Select" and "None" texts.

I am using this for a search and inputting "0" value instead of null for these choices gives me wrong results.

Many thanks

messageRe: How to change the value in <option value="?" >Please Select</option>
Posted by: panos (IP Logged)
Date: October 30, 2008 04:59AM

Hi, sorry for the delay but i got into something deep.

But i finaly got the answer to that problem smiling smiley

go to sc_classes.php around line 715, should be the line:

var sValue = record.getElementsByTagName("id")[0].firstChild.nodeValue;


and replace with:

var sValue;
if( record.getElementsByTagName("id")[0].firstChild==null )
sValue = '';
else
sValue = record.getElementsByTagName("id")[0].firstChild.nodeValue;

now it will work with empty <id> tag.

hope this will work for you also.

Best regards
Panos

messageRe: How to change the value in <option value="?" >Please Select</option>
Posted by: Goody (IP Logged)
Date: November 01, 2008 04:10PM

Hi Panos,

Thank you for the reply.

I tried as you had suggested but I am still getting the blank box for empty <id> tag. Any further ideas?

Cheers!

messageRe: How to change the value in <option value="?" >Please Select</option>
Posted by: panos (IP Logged)
Date: November 03, 2008 03:05AM

Strange.
Is there a chance having empty text also?
pls try doing the same for text node also, just after the mod at line 715, replace the line

var sText = record.getElementsByTagName("item")[0].firstChild.nodeValue;

with

var sText;
if( record.getElementsByTagName("item")[0].firstChild==null )
sText = '';
else
sText = record.getElementsByTagName("item")[0].firstChild.nodeValue;

Pls test and tell me.

messageRe: How to change the value in <option value="?" >Please Select</option>
Posted by: Goody (IP Logged)
Date: November 04, 2008 10:02AM

That's great, it displays "None" with null value ("") and that's exactly what I wanted.

Thank you for that, panos!

Please tell me, how could I have null value when it displays "Please Select" text?

Kind regards.

messageRe: How to change the value in <option value="?" >Please Select</option>
Posted by: panos (IP Logged)
Date: November 05, 2008 02:20AM

Nice smiling smiley

Look in function ajax_output_xml_for_none change the line should say
print '<id>0</id>';
or
print '<id>'.$this->select_prompt_key.'</id>';

hardcoded to
print '<id></id>';

and should do it.

Best regards
Panos

messageRe: How to change the value in <option value="?" >Please Select</option>
Posted by: Goody (IP Logged)
Date: November 06, 2008 03:58PM

Hi panos,

Tried as suggested but with no luck; "Please Select" text still gives me "0" value.

Any other suggestion?

Kind regards.



Sorry, only registered users may post in this forum.

All Rights Reserved 2006 Salix.gr  |  Design by Ades Design |  Hosting by e-emporio |  forum.Salix.gr powered by Phorum