Start ::
Developers Corner ::
Module Development ::
Problem retrieving HTML variables
Moderated by: Support Team
-
- rank:
-
pnFreshman
- registered:
- March 2008
- Status:
- offline
- last visit:
- 29.04.08
- Posts:
- 15
Hello !
I am using a combobox in a HTML pages. The combo is filled dynamically with values from database.
When i am reading those variables i can find only the first word of the sentence.
here is what i have done :
(HTML)
// HTML code to show the whole list of a product
<*select name="liste3" id="liste3">
<*option value="">BAIE
<*!--[foreach from=$id_baie item=iden]-->
<*option value=>
<*!--[/foreach]-->
<*/select>
(PHP)
$mac = FormUtil::getPassedValue('liste_macro',isset($args['liste_macro']) ? $args['liste_macro'] : null, 'REQUEST');
P.S : $mac variable is filled with the first word of the combo sentence
Do you have any idea about the problem ? thx
edited by: DJUS, Apr 07, 2008 - 03:06 PM -
- rank:
-
pnFreshman
- registered:
- March 2008
- Status:
- offline
- last visit:
- 29.04.08
- Posts:
- 15
I am sorry i made a copy paste error when i was writting this message ! you are right rgash i was using liste_macro not liste3!
<*select name="liste_macro" id="liste_macro">
<*option value="">
<*!--[foreach from=$macro item=mac]-->
<*option value=>
<*!--[/foreach]-->
<*/select>
(PHP)
$mac = FormUtil::getPassedValue('liste_macro',isset($args['liste_macro']) ? $args['liste_macro'] : null, 'REQUEST');
Always the same problem
Greetings
edited by: DJUS, Apr 08, 2008 - 04:05 PM -
- rank:
-
Steering Committee
- registered:
- January 2003
- Status:
- offline
- last visit:
- 01.05.08
- Posts:
- 550
Are you sure you have this selector in a "form" tag?
Otherwise, in your code where you have your FormUtil::getPassedValue() call, place the following line:
prayer ($_REQUEST);
This will show you what's in $_REQUEST (ie: what has been posted). If you don't see any output, place an "exit()" call after the prayer() call ... this is sometimes required when you immideately redirect ...
Greetings
R -
- rank:
-
pnFreshman
- registered:
- March 2008
- Status:
- offline
- last visit:
- 29.04.08
- Posts:
- 15
I use a form for my selector. And i palced a prayer ($_REQUEST) which showed me the value of each variable, liste_macro too : (string) liste_macro = Pouvoir
While what i selected in my combo box for example was the following sentence : Pouvoir separateur en atténuation
thanx for your help rgash!
Greetings
-
- rank:
-
pnFreshman
- registered:
- March 2008
- Status:
- offline
- last visit:
- 29.04.08
- Posts:
- 15
I don't think so, anyway i took a look at my HTML code and i couldn't find any error!
here is my form:
<*form class="numuserdate" action="" method="post" *enctype="application/x-www-form-urlencoded">
<*input type="text" name="macro_val" id="macro_val" value=""/>
<*input type="text" name="macro_ns" id="macro_ns" value=""/>
<*select name="liste_macro" id="liste_macro">
<*!--[foreach from=$macro item=mac]-->
<*option value=>
<*!--[/foreach]-->
<*/select>
Greetings
edited by: DJUS, Apr 09, 2008 - 05:41 PM -
- rank:
-
Steering Committee
- registered:
- January 2003
- Status:
- offline
- last visit:
- 01.05.08
- Posts:
- 550
Unfortunately, your select tag code above is incomplete, so I can't quite tell you what the issue is. Fact is, FormUtil is used extensively throughout PN and we've never seen a failure that couldn't be explained by a user/developer coding error.
Please post your complete HTML code for further analysis ...
Greetings
R -
- rank:
-
pnFreshman
- registered:
- March 2008
- Status:
- offline
- last visit:
- 29.04.08
- Posts:
- 15
Ok! I am sorry i should have post the whole code from the beginning !
Here is my code HTML:
<*form class="numuserdate" action=""
*method="post" enctype="application/x-www-form-urlencoded">
<*input type="text" name="macro_val" id="macro_val" value=""/>
<*input type="text" name="macro_ns" id="macro_ns" value=""/>
<*select name="liste_macro" id="liste_macro">
<*!--[foreach from=$macro item=mac]-->
<*option value=>
<*!--[/foreach]-->
<*/select>
<*input name="submit" type="submit" value="OK" />
<*input type="text" name="affich_macro" id="affich_macro" value=""/>
<*/form>
My PHP code :
$mac = FormUtil::getPassedValue('liste_macro',isset($args['liste_macro']) ? $args['liste_macro'] : null, 'REQUEST');
Greetings
edited by: DJUS, Apr 10, 2008 - 11:22 AM -
- rank:
-
pnProfessional
- registered:
- November 2003
- Status:
- offline
- last visit:
- 09.05.08
- Posts:
- 1530
The value of your option element needs to be double quoted, without them the parser stops reading at the first white space it gets to... hence you only getting the first word. All HTML name value pairs need to be double quoted as a matter of standards. Should look like this:
-----
viewTopiaryWorks($twWorks, $twRosterMaster) -
- rank:
-
pnFreshman
- registered:
- March 2008
- Status:
- offline
- last visit:
- 29.04.08
- Posts:
- 15
thanks everybody ! That was my problem !
I used the option value many times in my code without having to extract sentences with white space and it worked! That's why i haven't thought that it was the problem!
thanks again!
Start ::
Developers Corner ::
Module Development ::
Problem retrieving HTML variables
