Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

check form field bug?

Asked Modified Viewed 1,656 times
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
asked
Senior Member

i have a form and always my data from this two field will be rejected and bring an error. i have data for this fields (see screenshot) but i need retype to save it. Don't understand why

www.php-fusion.co.uk/infusions/forum/attachments/22.jpg


                        echo form_text("figure_retailprice", $locale['figurelib/admin/figurelib.php_050'], $data['figure_retailprice'], array(
                           "inline" => TRUE,
                           "width" => "300px",
                           "min" => "0",
                           "placeholder" => $locale['figurelib/admin/figurelib.php_051'],
                           "type" => "number"
                        ));
                  
                        echo form_text("figure_usedprice", $locale['figurelib/admin/figurelib.php_052'], $data['figure_usedprice'],array(
                           "inline" => TRUE,
                           "width" => "300px",
                           "min" => "0",
                           "placeholder" => $locale['figurelib/admin/figurelib.php_053'],
                           "type" => "number"
                        ));   


i find no resolution for this
the complete code is here: LINK
Catzenjaeger attached the following file:
22.jpg [No information available / 97 Downloads]
0 replies

4 posts

C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

I'd amend some lines on your codes.

https://github.com/Catzenjaeger/FigureLib_3/blob/master/infusions/figurelib/admin/admin_figurelib.php#L117-L118


"figure_retailprice"  => form_sanitizer($_POST['figure_retailprice'],  0, "figure_retailprice"),


So that the default return will be 0. Same for usedprice field.


And by right it should work and defender will not throw any error, remove the "min" => 0, since we do not have that.

As for why it throws an error, there could be an error somewhere, so I suggest you do a print by the end of line 148 with a


print_p($data);


So you can review what is the values you posted and the return of values.

I think defender has been coded not to accept 0 as a valid number. I'll return to defender's code on this.

Thanks for pointing out.
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Test set:


        $data['a'] = 0;
        if (isset($_POST['ab'])) {
            $data['a'] = form_sanitizer($_POST['a'], 0, 'a');
        }
        echo openform("inputform", "post", FUSION_SELF);
        echo form_text("a", "NUmber", $data['a'], array("type"=>"number", "inline" => true, "required"=>true));
        echo form_button("ab", "Submit", "abc");
        echo closeform();


Yes, when required is set to true, it will not accept 0 as a valid input. I've changed the validation for validate_number. Please get the latest update on the defender file. https://github.com/PHPFusion/PHPFusion/commit/1eb7c288050bad00ba5610b1c6d33b7d9162a739
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

hmn i get the same error again

what i have do:
1.) i have update your defender file
2.) change the admin_figurelib.php file

change this line

"figure_retailprice" => form_sanitizer($_POST['figure_retailprice'], "", "figure_retailprice"wink,
"figure_usedprice" => form_sanitizer($_POST['figure_usedprice'], "", "figure_usedprice"wink,

to

"figure_retailprice" => form_sanitizer($_POST['figure_retailprice'], 0, "figure_retailprice"wink,
"figure_usedprice" => form_sanitizer($_POST['figure_usedprice'], 0, "figure_usedprice"wink,

3.) add print_p($data); at end of my file
this show that:

[figure_retailprice] => 5.00
[figure_usedprice] => 10.00

but i get the error on top on my page again:

Quote

There was an error while processing your request
Retail Price ($) - Please fill out this field
Used Price ($) - Please fill out this field
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

Hello

someone is wrong now. I have update this here

Quote

Please get the latest update on the defender file. https://github.com/PHPFusion/PHPFusion/commit...7d9162a739


now in all forms where i have a number field i get an notice

Quote

There was an error while processing your request
Retail Price ($) - Attention: only numeric input from 1 to ..... possible
Used Price ($) - Attention: only numeric input from 1 to ..... possible
Edition Size - Attention: only numeric input from 1 to ..... possible


all entries now required but in my code i have none restriction for that!
Means that although there is no obligation an entry is expected. This is wrong. This should only come if I required to TRUE did

here as example the code for one field

Quote

// Text Field "Editions Size"
echo form_text("figure_editionsize", $locale['figure_451'], $submitdata['figure_editionsize'],
array(
"inline" => TRUE,
"width" => "400px",
"min" => "1",
"error_text" => $locale['figure_1816'],
"placeholder" => $locale['figure_1809'],
"type" => "number"
)
);
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 4 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

C
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet