The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
When creating a new admin control panel page I need to do some validation but maybe Im just staring at this too long.
Its not evaluating correctly and evals as true each and every time under any condition - blank or populated. uploads_location is the input element name control. Code:
if (empty($vbulletin->GPC['uploads_location']))
{
print_stop_message('fieldmissing');
}
|
|
#2
|
|||
|
|||
|
Run var_dump($vbulletin->GPC['uploads_location']); die(); on line above the code you posted and see what it returns. If it doesn't return anything you have probably made a typo in one of the names or something.
|
|
#3
|
||||
|
||||
|
Ok, on the submitted page it printed out "NULL".
![]() The spelling is correct and I use print_input_row with the second parameter as 'uploads_location' and third with a 'test' value. So its even loaded upon page load but if I type anyting into it or leave it as is it still evals to an empty field. How should I be validating upon the submit? I already have a do value specified on the form opening line. I cant have it reload the page and eval the do with any variables passed as it will never match the if($_POST['do'] == |
|
#4
|
|||
|
|||
|
Part 1) What code are you using to clean the variable then?
Part 2) Submit it to another do action. e.g. if($_REQUEST['do'] == 'doadd') or something of the sort or you can add a hidden field to the form and check if that has been submitted in order to switch between processing the form or displaying the form. |
|
#5
|
||||
|
||||
|
Clean? Im still new to vB and PHP but I think clean writes a value to a cookie?
So I should be storing the element id and value to a cookie using something like... Code:
$vbulletin->input->clean_array_gpc('p', array(
'uploads_location' => TYPE_STR,
'txtUploadLocation' => TYPE STR'
));
|
|
#6
|
|||
|
|||
|
Doesn't that give you any parse errors? You have a rouge apostrophe after the TYPE STR, which should also be TYPE_STR.
Try this: PHP Code:
|
|
#7
|
||||
|
||||
|
Ok changes made (yes it did parse error but I hadnt updated my post yet
). Still doesnt read the inputbox value. I placed the code in the forms construction between the form tags.I have searched the vB documentation over at vB.com and searched all over here too. Doesnt seem to be too much on form validation
|
|
#8
|
|||
|
|||
|
run:
PHP Code:
|
|
#9
|
||||
|
||||
|
Arrg, still NULL.
This is what I have... PHP Code:
|
|
#10
|
|||
|
|||
|
Try:
PHP Code:
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|