⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

ID attributes in edit.php and add.php



rafael84
  • profile picture
  • Member

Posted 24 December 2011 - 18:12 PM

Hello guys,

I have just started working with Grocery Crud and am very impressed with the results.
To improve the library, I'd like to suggest some small changes on edit.php and add.php, as follows:

[html] <div class='form-field-box <?php echo $even_odd?>' id="<?php echo $field->field_name; ?>_field_box">
<div class='form-display-as-box' id="<?php echo $field->field_name; ?>_display_as_box">
<?php echo $input_fields[$field->field_name]->display_as?><?php echo ($input_fields[$field->field_name]->required)? "* " : ""?> :
</div>
<div class='form-input-box' id="<?php echo $field->field_name; ?>_input_box">
<?php echo $input_fields[$field->field_name]->input?>
</div>
<div class='clear'></div>
</div>
[/html]

The only difference from the original code are the ids:

id="<?php echo $field->field_name; ?>_field_box"

id="<?php echo $field->field_name; ?>_display_as_box"

id="<?php echo $field->field_name; ?>_input_box"


By adding those id attributes we can customize the generated form using CSS.

Check out the sample form I have attached this post.

So, what do you think?

Can it be changed that way?

-Rafael

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 25 December 2011 - 08:54 AM

[quote name='rafael84' timestamp='1324750358' post='166']
Hello guys,

I have just started working with Grocery Crud and am very impressed with the results.
To improve the library, I'd like to suggest some small changes on edit.php and add.php, as follows:

[html] <div class='form-field-box <?php echo $even_odd?>' id="<?php echo $field->field_name; ?>_field_box">
<div class='form-display-as-box' id="<?php echo $field->field_name; ?>_display_as_box">
<?php echo $input_fields[$field->field_name]->display_as?><?php echo ($input_fields[$field->field_name]->required)? "* " : ""?> :
</div>
<div class='form-input-box' id="<?php echo $field->field_name; ?>_input_box">
<?php echo $input_fields[$field->field_name]->input?>
</div>
<div class='clear'></div>
</div>
[/html]

The only difference from the original code are the ids:

id="<?php echo $field->field_name; ?>_field_box"

id="<?php echo $field->field_name; ?>_display_as_box"

id="<?php echo $field->field_name; ?>_input_box"


By adding those id attributes we can customize the generated form using CSS.

Check out the sample form I have attached this post.

So, what do you think?

Can it be changed that way?

-Rafael
[/quote]

Hello Rafael and welcome to grocery CRUD community.

Actually I think it's a pretty good and easy idea. I think I will have it at the next version. Pretty clever and nice view.

If you don't mind, can you please copy the Spanish language and add it to the topic extras and plugins at /forum/8-extra-coding-plugins/ so everybody can have the opportunity to have the Spanish language file?

Thank you

rafael84
  • profile picture
  • Member

Posted 26 December 2011 - 00:43 AM

Thanks Johnny, I really appreciate your attention to my suggestion.
I just posted my language file, which is actually a Brazilian Portuguese version.
Thankfully someone else has already posted the Spanish translation too.

tareq
  • profile picture
  • Member

Posted 25 January 2012 - 11:53 AM

Hi,
This is a very good tric. but I am trying to put ID in <input> tag like <input type='text' name='pnumber' id='bangla' />
any help are welcome.

Thanks,
Tareq

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 25 January 2012 - 19:01 PM

[quote name='rafael84' timestamp='1324860206' post='172']
Thanks Johnny, I really appreciate your attention to my suggestion.
I just posted my language file, which is actually a Brazilian Portuguese version.
Thankfully someone else has already posted the Spanish translation too.
[/quote]
@rafael84 sorry I didn't added to this version. I just... forgot it. I stil believe its a good idea and I will added when I have time.
Thanks

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 01 March 2012 - 22:03 PM

@rafael84 I finally include your patch at the new version 1.2 ( https://github.com/scoumbourdis/grocery-crud/commit/672ced464bc419d9ffcbc5581fcd0319d07705d8 ).

Thanks

naufal
  • profile picture
  • Member

Posted 13 March 2012 - 14:08 PM

Thank you, i want it too :)

naufal
  • profile picture
  • Member

Posted 16 March 2012 - 10:27 AM

the new version 1.2 has been released,

now how can i do that like sample form? ty

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 20 March 2012 - 21:59 PM

You just have to add custom CSS with the ids. You will change the width the height e.t.c.

likhon3k
  • profile picture
  • Member

Posted 05 February 2013 - 04:00 AM

Hello guys,

I have just started working with Grocery Crud and am very impressed with the results.
To improve the library, I'd like to suggest some small changes on edit.php and add.php, as follows:

[html] <div class='form-field-box <?php echo $even_odd?>' id="<?php echo $field->field_name; ?>_field_box">
<div class='form-display-as-box' id="<?php echo $field->field_name; ?>_display_as_box">
<?php echo $input_fields[$field->field_name]->display_as?><?php echo ($input_fields[$field->field_name]->required)? "* " : ""?> :
</div>
<div class='form-input-box' id="<?php echo $field->field_name; ?>_input_box">
<?php echo $input_fields[$field->field_name]->input?>
</div>
<div class='clear'></div>
</div>
[/html]

The only difference from the original code are the ids:
 

id="<?php echo $field->field_name; ?>_field_box"
id="<?php echo $field->field_name; ?>_display_as_box"
id="<?php echo $field->field_name; ?>_input_box"
By adding those id attributes we can customize the generated form using CSS.

Check out the sample form I have attached this post.

So, what do you think?

Can it be changed that way?

-Rafael

 

can you please give an example how to show two or more input field in one row? I am searching but failed to find out.