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
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mazdev responded to »Hide "Register new account" and change template to 3 col« 07:50 AM
- mesteele101 created topic »Zikula 1.3.3 - Site Search 1.5.2 - Unable to turn off plug-ins« 07:48 AM
- internetking created topic »password problem« 25. May
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
- mdee created topic »How to implement returnpage ?« 25. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Problem retrieving HTML variables
-
- Rank: Team Member
- Registered: Jan 05, 2003
- Last visit: May 28, 2010
- Posts: 775
Looking at your select list code, your call to FormUtil::getPassedValue() should use "liste3" as the first parameter ...
Greetings
R
-
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Aug 18, 2008
- Posts: 19
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: Team Member
- Registered: Jan 05, 2003
- Last visit: May 28, 2010
- Posts: 775
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 -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Aug 18, 2008
- Posts: 19
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: Team Member
- Registered: Jan 05, 2003
- Last visit: May 28, 2010
- Posts: 775
Could it be that you didn't enclose your value in quotes? Take a look at your HTML source code in order to verify this ...
Greetings
R -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Aug 18, 2008
- Posts: 19
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: Team Member
- Registered: Jan 05, 2003
- Last visit: May 28, 2010
- Posts: 775
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 -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Aug 18, 2008
- Posts: 19
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: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
You must use code tags to post code here - see the 'select code type' drop down for specific code formatting types.
-Mark
--
Visit My homepage and Zikula themes. -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Aug 18, 2008
- Posts: 19
Here it is :
Code
<form class="numuserdate" action="<!--[pnmodurl modname="num" type="user" func="macro"]-->" method="post"enctype="application/x-www-form-urlencoded">
<input type="text" name="macro_val" id="macro_val" value="<!--[$type]-->"/>
<input type="text" name="macro_ns" id="macro_ns" value="<!--[$num_serie]-->"/>
<select name="liste_macro" id="liste_macro">
<!--[foreach from=$macro item=mac]-->
<option value=<!--[$mac.lib]-->><!--[$mac.lib]--></option>
<!--[/foreach]-->
</select>
<input name="submit" type="submit" value="OK" />
<input type="text" name="affich_macro" id="affich_macro" value="<!--[$i_mac]-->"/>
</form>
My PHP code :
Code
$mac = FormUtil::getPassedValue('liste_macro',isset($args['liste_macro']) ? $args['liste_macro'] : null, 'REQUEST');
Greetings
edited by: DJUS, Apr 10, 2008 - 12:10 PM -
- Rank: Expert
- Registered: Nov 23, 2003
- Last visit: Dec 13, 2009
- Posts: 1487
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:
Code
<option value="<!--[$mac.lib]-->"><!--[$mac.lib]--></option>
--
Under Construction! -
**unknown user**
- Rank: Registered User
- Registered: Mar 16, 2002
- Last visit: Aug 18, 2008
- Posts: 19
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!
- Moderated by:
- Support
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
