Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with hidden value #7

Open
ghost opened this issue Jun 21, 2016 · 2 comments
Open

Problem with hidden value #7

ghost opened this issue Jun 21, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 21, 2016

I am using this code which has been working great, however, I have a slight issue with the hidden field. The attributes for a hidden field takes a string (In the documentation it says it takes an array), not an array which every other field takes. Can you please add a check in there that if an array is passed that it grabs the value field and converts it to a string?

@avbdr
Copy link
Owner

avbdr commented Aug 10, 2016

can you please provide a sample please?

@ghost
Copy link
Author

ghost commented Aug 10, 2016

Sure, so when you call the form builder for any other functions, you call it like this:

$form = Form::open( "form", NULL, array(
    "prevent" => array(
        "bootstrap",
        "jQuery",
        "jqueryui"
    )
) );
$form_class->Select( String $label, String $id, $options, Array $attributes = array( 'value' => 'somevalue' ) );
$form->close( FALSE );

However, when you use the Hidden one, it is used like this:

$form_class->Hidden( String $id, String 'somevalue' );

When I was working with it I was trying to figure out what was wrong because I was passing an array into that field with the option value like every other field type and it was hard to figure out what was wrong. What I am proposing is to add an option to check if it is an array for Hidden and if so, convert it to a string automatically instead of throwing an error.

I would have added it myself and sent it to you for a potential merge, but I am not sure how to do that in github.

Hope that is easy to understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant